This repository was archived by the owner on Jan 30, 2020. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork18
[BUG] This fix allows the upload of same filenames in input type file#13
Merged
weierophinney merged 1 commit intozendframework:masterfromcodisart:bugfix-allow-same-filename-uploadFeb 16, 2016
Merged
[BUG] This fix allows the upload of same filenames in input type file#13
weierophinney merged 1 commit intozendframework:masterfromcodisart:bugfix-allow-same-filename-uploadFeb 16, 2016
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
For example, Ios Safari gives the name image.jpg for pcitures from the galleryIn the present situation, the first files would be overriden by the last file with the same name.And the getValue of these inputs will return the same fileName with no really mean to identify it.With the use of the unique name from PHP $_FILES in the name column of the $_files array of the Http adapter, the files will be unique and easily identifiable.- Fix the unit tests and add a new one for the same filename case.
weierophinney added a commit that referenced this pull requestFeb 16, 2016
[BUG] This fix allows the upload of same filenames in input type file
weierophinney added a commit that referenced this pull requestFeb 16, 2016
weierophinney added a commit that referenced this pull requestFeb 16, 2016
wolxXx commentedMar 3, 2017
sadly, this breakes the possibility to save the original file name. |
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For example, Safari on IOS gives the name image.jpg for pictures from the gallery
In the present situation, the first files would be overriden by the last file with the same name.
And the getValue of these inputs will return the same fileName with no really mean to identify it.
With the use of the unique name from PHP $_FILES in the name column of the $_files array of the Http adapter, the files will be unique and easily identifiable.
I have adjusted the unit test for the File/Transfer/Adapter/HttpTest::testMultiFiles() method and added one for a same name case.
First, the $_FILES is mocked with the implication that the "name" value can be a path with more than one directory. Shouldn't it be only a filename like picture.jpg, document.docx or script.php ?
Secondly, the "tmp_name" value doesn't seem to be mocked properly, or the format %TMP_DIRECTORY%/php123456 can be overriden ?
Codisart