Skip to content

Commit d55b080

Browse files
davimacedoflovilmart
authored andcommitted
Encode File URI (#30)
1 parent e564407 commit d55b080

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ node_modules
3131

3232
# Optional REPL history
3333
.node_repl_history
34+
35+
# Webstorm
36+
.idea/

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ S3Adapter.prototype.getFileData = function(filename) {
122122
// Generates and returns the location of a file stored in S3 for the given request and filename
123123
// The location is the direct S3 link if the option is set, otherwise we serve the file through parse-server
124124
S3Adapter.prototype.getFileLocation = function(config, filename) {
125+
filename = encodeURIComponent(filename);
125126
if (this._directAccess) {
126127
if (this._baseUrl && this._baseUrlDirect) {
127128
return `${this._baseUrl}/${filename}`;
@@ -131,7 +132,7 @@ S3Adapter.prototype.getFileLocation = function(config, filename) {
131132
return `https://${this._bucket}.s3.amazonaws.com/${this._bucketPrefix + filename}`;
132133
}
133134
}
134-
return (config.mount + '/files/' + config.applicationId + '/' + encodeURIComponent(filename));
135+
return (config.mount + '/files/' + config.applicationId + '/' + filename);
135136
}
136137

137138
module.exports = S3Adapter;

0 commit comments

Comments
 (0)