You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Location is a const fed in from getFileLocation, but getFileLocation will always return the location before key generation occurs.
object location created by this.adpter.createFile as an output argument is discarded.
Additionally, getFileLocation will return the presigned item based on the old filename rather than the new file name.
Ex:
generateKey: (filename) => {
return ${Date.now()}_${filename}; // unique prefix for every filename
}
Uploading "file.jpeg" will result in XXX.s3.amazonaws.com/file.jpeg as a key while uploading to XXX.s3.amazonaws.com/XXXX_file.jpeg
getFileLocation will return the full (optionally presignedUrl) or "https://${this._bucket}.s3.amazonaws.com/${this._bucketPrefix}${fileName}" where fileName is file.jpeg
However createFile will instead return a location of
https://${this._bucket}.s3.${this._region}.amazonaws.com/this._bucketPrefix + this._generateKey(filename)
Until this issue is fixed, generateKey should be considered to be non-functional. Either the filename should be rewritten with the generated Key prior to getFileLocation (and the createFile call should not generate a new key) or the FilesController.js should be wrapped to account for this.
The text was updated successfully, but these errors were encountered:
I'm using v4.0 but best I can tell from the code inspection since it
appears to be related to a need to work around the parse-server
integration, this issue would pre-exist the new release.
From parse-server\lib\Controllers\FilesController.js - line 32
Location is a const fed in from getFileLocation, but getFileLocation will always return the location before key generation occurs.
object location created by this.adpter.createFile as an output argument is discarded.
Additionally, getFileLocation will return the presigned item based on the old filename rather than the new file name.
Ex:
getFileLocation will return the full (optionally presignedUrl) or "https://${this._bucket}.s3.amazonaws.com/${this._bucketPrefix}${fileName}" where fileName is file.jpeg
However createFile will instead return a location of
https://${this._bucket}.s3.${this._region}.amazonaws.com/this._bucketPrefix + this._generateKey(filename)
Until this issue is fixed, generateKey should be considered to be non-functional. Either the filename should be rewritten with the generated Key prior to getFileLocation (and the createFile call should not generate a new key) or the FilesController.js should be wrapped to account for this.
The text was updated successfully, but these errors were encountered: