order ticket

This commit is contained in:
hamid zarghami
2026-01-28 16:01:00 +03:30
parent a5ea0174ee
commit 10245bdb08
9 changed files with 577 additions and 80 deletions
+21
View File
@@ -65,3 +65,24 @@ export const extractErrorMessage = (
return fallbackMessage;
}
};
export const getFileNameAndExtensionFromUrl = (
url: string,
): { fileName: string; extension: string } => {
try {
const cleanUrl = url.split("?")[0].split("#")[0];
const lastPart = cleanUrl.substring(cleanUrl.lastIndexOf("/") + 1);
if (!lastPart || !lastPart.includes(".")) {
return { fileName: "", extension: "" };
}
const lastDotIndex = lastPart.lastIndexOf(".");
const fileName = lastPart.substring(0, lastDotIndex);
const extension = lastPart.substring(lastDotIndex + 1);
return { fileName, extension };
} catch {
return { fileName: "", extension: "" };
}
};