[WEB-4357] fix: remove trailing slash from asset url #7240

This commit is contained in:
Prateek Shourya
2025-06-19 19:09:59 +05:30
committed by GitHub
parent 24e57009af
commit c3c1aef7a9

View File

@@ -44,6 +44,8 @@ export const getFileMetaDataForUpload = (file: File): TFileMetaDataLite => ({
* @returns {string} assetId
*/
export const getAssetIdFromUrl = (src: string): string => {
// remove the last char if it is a slash
if (src.charAt(src.length - 1) === "/") src = src.slice(0, -1);
const sourcePaths = src.split("/");
const assetUrl = sourcePaths[sourcePaths.length - 1];
return assetUrl;