Hi. Today I had a time to change the code. This is final code:
getFileLocation(config, filename) {
const fileName = filename.split('/').map(encodeURIComponent).join('/');
if (this._directAccess) {
if(this._baseUrl){
if (this._baseUrl instanceof Function) {
if (this._baseUrlDirect) {
return `${this._baseUrl(filename)}/${fileName}`;
}
return `${this._baseUrl(filename)}/${this._bucketPrefix + fileName}`;
}
else{
if (this._baseUrlDirect) {
return `${this._baseUrl}/${fileName}`;
}
return `${this._baseUrl}/${this._bucketPrefix + fileName}`;
}
}
return `https://${this._bucket}.s3.amazonaws.com/${this._bucketPrefix + fileName}`;
}
return (`${config.mount}/files/${config.applicationId}/${fileName}`);
}
Can you look if its ok?
But Only thing I’m confused is what variable ı would pass into baseUrl function? filename
from getFileLocation(config, filename)
or fileName
from const fileName = filename.split('/').map(encodeURIComponent).join('/');
Which one should I pass into this._baseUrl(filename)
?