1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-09-23 19:08:25 +02:00

Warn if file output path exceeds Windows's maximum length (#891)

Added check for exceeding MAX_PATH limit in windows. Should be relatively easy to add an actual fix from here.

Co-authored by @coderabbit

---------

Co-authored-by: Aaron Liu <aaronliu0130@gmail.com>
This commit is contained in:
Josh Rufer 2024-07-08 22:44:49 -05:00 committed by GitHub
parent f5160601e0
commit 4fe8c437d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -57,6 +57,12 @@ const imageUpscayl = async (event, payload: ImageUpscaylPayload) => {
const isDefaultModel = DEFAULT_MODELS.includes(model);
// Check if windows can write the new filename to the file system
if (outFile.length >= 255) {
logit("Filename too long for Windows.");
mainWindow.webContents.send(COMMAND.UPSCAYL_ERROR, "The filename exceeds the maximum path length allowed by Windows. Please shorten the filename or choose a different save location.");
}
// UPSCALE
if (fs.existsSync(outFile) && !overwrite) {
// If already upscayled, just output that file