getFileLocation does not URI encode filename in directAccess cases
rdbayer opened this issue · comments
Ross Bayer commented
Ross Bayer commented
Among other things, this can make filenames with spaces in them fail from an iOS client, for example
Ross Bayer commented
I don't know how the contribution process works, but I believe the fix is that the function should look like this:
S3Adapter.prototype.getFileLocation = function(config, filename) {
var encodedFilename = encodeURIComponent(filename);
if (this._directAccess) {
if (this._baseUrl && this._baseUrlDirect) {
return `${this._baseUrl}/${encodedFilename}`;
} else if (this._baseUrl) {
return `${this._baseUrl}/${this._bucketPrefix + encodedFilename}`;
} else {
return `https://${this._bucket}.s3.amazonaws.com/${this._bucketPrefix + encodedFilename}`;
}
}
return (config.mount + '/files/' + config.applicationId + '/' + encodedFilename);
}
Florent Vilmart commented
Open a pull request with the fix and the according tests.
More info on github pull requests here:
https://help.github.com/articles/about-pull-requests/
Ross Bayer commented
Sorry, don't have the time (or confidence, since I'm new to this code) to check it in for everyone, but it did fix issues I was having.
Arthur Cinader commented
fixed by: #30