Add direct image download to pdf-to-jpg
This commit is contained in:
@@ -460,3 +460,22 @@ export function formatRawDate(raw: string): string {
|
||||
}
|
||||
return raw;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sanitized PDF filename.
|
||||
*
|
||||
* The provided filename is processed as follows:
|
||||
* - Removes a trailing `.pdf` file extension (case-insensitive)
|
||||
* - Trims leading and trailing whitespace
|
||||
* - Truncates the name to a maximum of 80 characters
|
||||
*
|
||||
* @param filename The original filename (including extension)
|
||||
* @returns The sanitized filename without the `.pdf` extension, limited to 80 characters
|
||||
*/
|
||||
export function getCleanPdfFilename(filename: string): string {
|
||||
let clean = filename.replace(/\.pdf$/i, '').trim();
|
||||
if (clean.length > 80) {
|
||||
clean = clean.slice(0, 80);
|
||||
}
|
||||
return clean;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user