-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IBX-368: Added image path normalization before storing it into the DB #3102
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice & compact. I'm only wondering if this is the right place for a binding to Flysystem, given that other handlers can be used? Other handlers might have other normalising rules, even stricter than Flysystem, so this might not be correct/enough.
Second, might we need this for non-image files too?
|
I didn't mean multiple, just that Flysystem is documented as "default", implying it can be replaced by something else, so seems odd to have Flysystem code in the generic ImageStorage class. Where else? Not sure, but I imagine the flysystem binarydatahandler could do it, and afterwards ImageStorage::storeFieldData could check with the returned binaryfile object if the filename is still the same as it was in the create struct. If not, update the $targetPath used further on in storeFieldData. Or we could ask the ioservice up front if it wants to modify the name, and the ioservice asks the configured handler, which returns the corrected name, which we then use in the create struct. A bigger code change, but isn't it how we usually roll with regards to separation of concerns? Anyway, if Andrew is happy, I'm happy :) |
Oh, I understand now - I'll give it a second look. Thanks @glye . |
eZ/Publish/Core/FieldType/Image/ImageStorage/Gateway/DoctrineStorage.php
Outdated
Show resolved
Hide resolved
eZ/Bundle/EzPublishCoreBundle/Command/NormalizeImagesPathsCommand.php
Outdated
Show resolved
Hide resolved
eZ/Bundle/EzPublishCoreBundle/Command/NormalizeImagesPathsCommand.php
Outdated
Show resolved
Hide resolved
eZ/Bundle/EzPublishCoreBundle/Command/NormalizeImagesPathsCommand.php
Outdated
Show resolved
Hide resolved
eZ/Bundle/EzPublishCoreBundle/Command/NormalizeImagesPathsCommand.php
Outdated
Show resolved
Hide resolved
eZ/Bundle/EzPublishCoreBundle/Command/NormalizeImagesPathsCommand.php
Outdated
Show resolved
Hide resolved
eZ/Bundle/EzPublishCoreBundle/Command/NormalizeImagesPathsCommand.php
Outdated
Show resolved
Hide resolved
eZ/Publish/Core/FieldType/Image/ImageStorage/Gateway/DoctrineStorage.php
Outdated
Show resolved
Hide resolved
eZ/Publish/Core/FieldType/Image/ImageStorage/Gateway/DoctrineStorage.php
Outdated
Show resolved
Hide resolved
eZ/Publish/Core/FieldType/Image/ImageStorage/Gateway/DoctrineStorage.php
Outdated
Show resolved
Hide resolved
eZ/Bundle/EzPublishCoreBundle/Command/NormalizeImagesPathsCommand.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ezsystems/documentation-team proofread the messages to users please (pointed out below)
eZ/Bundle/EzPublishCoreBundle/Command/NormalizeImagesPathsCommand.php
Outdated
Show resolved
Hide resolved
eZ/Bundle/EzPublishCoreBundle/Command/NormalizeImagesPathsCommand.php
Outdated
Show resolved
Hide resolved
eZ/Bundle/EzPublishCoreBundle/Command/NormalizeImagesPathsCommand.php
Outdated
Show resolved
Hide resolved
eZ/Bundle/EzPublishCoreBundle/Command/NormalizeImagesPathsCommand.php
Outdated
Show resolved
Hide resolved
eZ/Bundle/EzPublishCoreBundle/Command/NormalizeImagesPathsCommand.php
Outdated
Show resolved
Hide resolved
eZ/Bundle/EzPublishCoreBundle/Command/NormalizeImagesPathsCommand.php
Outdated
Show resolved
Hide resolved
eZ/Bundle/EzPublishCoreBundle/Command/NormalizeImagesPathsCommand.php
Outdated
Show resolved
Hide resolved
eZ/Bundle/EzPublishCoreBundle/Command/NormalizeImagesPathsCommand.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, some questions aside.
eZ/Publish/Core/FieldType/Image/ImageStorage/Gateway/DoctrineStorage.php
Show resolved
Hide resolved
eZ/Publish/Core/FieldType/Image/ImageStorage/Gateway/DoctrineStorage.php
Show resolved
Hide resolved
eZ/Publish/Core/FieldType/Image/ImageStorage/Gateway/DoctrineStorage.php
Show resolved
Hide resolved
eZ/Publish/Core/FieldType/Image/ImageStorage/Gateway/DoctrineStorage.php
Show resolved
Hide resolved
eZ/Publish/Core/FieldType/Image/ImageStorage/Gateway/DoctrineStorage.php
Outdated
Show resolved
Hide resolved
eZ/Publish/Core/FieldType/Image/ImageStorage/Gateway/DoctrineStorage.php
Outdated
Show resolved
Hide resolved
eZ/Bundle/EzPublishCoreBundle/Command/NormalizeImagesPathsCommand.php
Outdated
Show resolved
Hide resolved
eZ/Publish/Core/FieldType/Image/ImageStorage/Gateway/DoctrineStorage.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QA approved on eZPlatform-ee 2.5 & 2.5.20 with patch & diff.
Could you please merge up changed @mateuszbieniek? |
Merge up PR: ezsystems/ezplatform-kernel#197 |
7.5+
When
Flysystem
stores the image, the path is normalized and (for example) unprintable utf8 characters are dropped. The same transformation is not applied to the path stored in theezimagefile
table, which leads to 404 errors.As the issue did not occur in legacy, an image path normalization command has to be implemented for migrating projects.
TODO:
$ composer fix-cs
).