filestack-js
filestack-js copied to clipboard
Path in PickerStoreOptions gets URL escaped when saved to azure
We are currently integrating filestack with our application and we ran into this bug when trying to upload to azure storage:
Steps to reproduce:
<script type="text/javascript" src="https://static.filestackapi.com/v3/filestack.js"></script>
<script>
var client = filestack.init('TOKEN_HERE');
function showPicker(){
client.pick({
uploadInBackground: false,
disableStorageKey:true,
fromSources:['local_file_system','googledrive'],
storeTo:{
container:'global',
location:'azure',
path:'images/accounts/'
},
onFileUploadFinished: (response) => {
console.log(response);
}
});
}
</script>
<input type="button" value="Upload" onclick="showPicker()" />
Upload any file from google storage
What is expected?
In browser's console the key should be logged without being URL escaped:
[{ ..., "key":"global/images/account/filename.pdf", ...}]
You will get the expected result when uploading from "local_file_system" using V3 but not when using google drive. The key doesn't exist for local_file_system but in azure storage, the file is placed at the right location.
What is actually happening?
In browser's console the key is logged as URL escaped value:
[{ ..., "key":"global%2fimages%2faccount%2ffilename.pdf", ...}]
In the azure storage explorer, the uploaded file does not appear at the right location, instead it appears on the root of the container with the name global%2fimages%2faccount%2ffilename.pdf
See image below:
Hi Piter,
Any news on this one?
Hi,
change your path to:
path:'/images/accounts/'
Will work for version 2.x.x.
I confirm it works with a '/' at the beginning of the path. Thank you
I believe there has been a regression on this bug. I am having the same issue again with Azure Storage. Please view initial summary in order to reproduce with the '/' at the beginning of the path.
Hi @GODBS , in which version?
I've tried version 3.17.0 which is the latest i believe.
Hi Mary,
Have you gotten any news on this?
Hi @GODBS could you please contact our support to provide apikey, we need to check your app settings. I cant reproduce your problem on our accounts.