Jump to content

Why is \IPS\File\FileSystem being called on S3 storage?


Makoto
 Share

Go to solution Solved by Makoto,

Recommended Posts

I'm seeing a client utilizing my Gallery Enhancments plugin running into the following error,

RuntimeException::0
IPS\File\_FileSystem->getImageDimensions()

This is caused by the file not existing here,

		if ( ! file_exists( $file ) )
		{
			throw new \RuntimeException;
		}

..and the reason the file doesn't exist, is because the client is using S3 storagenot the FileSystem.

So.. why is IPS making a call to \IPS\File\FileSystem, not \IPS\File\Amazon?

Code in question:

https://github.com/FujiMakoto/ips-gallery-enhancements/blob/master/hooks/GalleryImage.php#L40

This should be pulling from Amazon using the base getImageDimensions method in \IPS\File here, but apparently it's not?

Link to comment
Share on other sites

#0 [Redact]/init.php(820) : eval()'d code(56): IPS\File\_FileSystem->getImageDimensions()
#1 [Redact]/system/Patterns/ActiveRecord.php(335): IPS\gallery\hook1028->get_originalData()
#2 [Redact]/init.php(820) : eval()'d code(655): IPS\Patterns\_ActiveRecord->__get('originalData')
#3 [Redact]/init.php(820) : eval()'d code(35): IPS\Patterns\rules_hook_ipsPatternsActiveRecord->__get('originalData')
#4 [Redact]/uploads/template_2_dd7fa6b771626a3f041bfec4dc0472c8_view.php(2624): IPS\gallery\rules_hook_ipsGalleryImage->__get('originalData')
#5 [Redact]/system/Theme/SandboxedTemplate.php(61): IPS\Theme\Cache\class_gallery_front_view->imageLightboxFrame(Object(IPS\gallery\Image))
#6 [Redact]/uploads/template_2_dd7fa6b771626a3f041bfec4dc0472c8_view.php(2594): IPS\Theme\_SandboxedTemplate->__call('imageLightboxFr...', Array)
#7 [Redact]/system/Theme/SandboxedTemplate.php(61): IPS\Theme\Cache\class_gallery_front_view->imageLightbox(Object(IPS\gallery\Image), '\n<div data-cont...')
#8 [Redact]/applications/gallery/modules/front/gallery/view.php(324): IPS\Theme\_SandboxedTemplate->__call('imageLightbox', Array)
#9 [Redact]/init.php(820) : eval()'d code(34): IPS\gallery\modules\front\gallery\_view->manage()
#10 [Redact]/system/Dispatcher/Controller.php(96): IPS\gallery\modules\front\gallery\hook1030->manage()
#11 [Redact]/system/Content/Controller.php(50): IPS\Dispatcher\_Controller->execute()
#12 [Redact]/applications/gallery/modules/front/gallery/view.php(61): IPS\Content\_Controller->execute()
#13 [Redact]/system/Dispatcher/Dispatcher.php(152): IPS\gallery\modules\front\gallery\_view->execute()
#14 [Redact]/index.php(13): IPS\_Dispatcher->run()
#15 {main}

I've had two people report this so far. I'm going to try and set up S3 locally in a bit and see if I can reproduce it myself. Not sure why this would be happening other than some kind of misconfiguration like you said.

Link to comment
Share on other sites

  • Solution

Wow. Someone smack me.

$file = \IPS\File::get('gallery_Image', $this->original_file_name);

It's gallery_Images, not gallery_Image.

It seems File::get does not throw any kind of error or exception if you provide an invalid storage extension, and this results in it sometimes "just working" if you're not using a custom setup.

@Ryan Ashbrook is there a chance we can have a check performed here to prevent hard to debug issues like this in the future?

Edited by Makoto
Link to comment
Share on other sites

35 minutes ago, Makoto said:

Wow. Someone smack me.


$file = \IPS\File::get('gallery_Image', $this->original_file_name);

It's gallery_Images, not gallery_Image.

It seems File::get does not throw any kind of error or exception if you provide an invalid storage extension, and this results in it sometimes "just working" if you're not using a custom setup.

@Ryan Ashbrook is there a chance we can have a check performed here to prevent hard to debug issues like this in the future?

I'll raise it.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...