Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

Fix reported path when file name also occurs in parent directory name(s) #1977

Merged
merged 3 commits into from
Mar 2, 2018

Conversation

ogvolkov
Copy link
Contributor

@ogvolkov ogvolkov commented Mar 1, 2018

Brief description of the changes

Fixes reported path (qqpath) in case when the file name in question appears in one of its parent directory names, see #1976. The original code used indexOf so if the first occurrence was not a file name itself, it stripped way too much from the path.

What browsers and operating systems have you tested these changes on?

Chrome 64.0.3282.167, FF 58.0.2, Edge 41.16299.248.0

Have you written unit tests? If not, explain why.

Unit tests are present, both for normal case where I used the value the current code returns as a reference, and for the case when directory name is the same as the file name.

@rnicholus
Copy link
Member

just to be clear, the only change was fullPath.indexOf(name) -> fullPath.lastIndexOf(name)?

@ogvolkov
Copy link
Contributor Author

ogvolkov commented Mar 1, 2018

Yes, the functional change is only that.
However to have it tested I've extracted it as a separate function, which is also a bit cleaner imo.

@rnicholus rnicholus merged commit 007c4de into FineUploader:master Mar 2, 2018
@rnicholus
Copy link
Member

thanks for your work on this! I'm going to release this as 5.15.7 shortly

@rnicholus
Copy link
Member

travis-ci is currently broken (this actually happens a lot in my experience) so i'll be able to release once that's fixed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants