mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-07-08 01:31:00 +08:00
Bug fix: A gallery may contains two image which have same name
This commit is contained in:
12
utils.ts
12
utils.ts
@@ -152,3 +152,15 @@ export function configureZipJs() {
|
||||
configure({ useWebWorkers: false });
|
||||
zipjs_configured = true;
|
||||
}
|
||||
|
||||
export function add_suffix_to_path(path: string, suffix?: string) {
|
||||
if (suffix === undefined) {
|
||||
suffix = Math.round(Math.random() * 100000).toString();
|
||||
}
|
||||
const ext = extname(path);
|
||||
if (ext) {
|
||||
return `${path.slice(0, path.length - ext.length)}-${suffix}${ext}`;
|
||||
} else {
|
||||
return `${path}-${suffix}`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user