Skip to content

πŸ†™ Upscayl - #1 Free and Open Source AI Image Upscaler for Linux, MacOS and Windows.

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

Josh Rufer4fe8c437d71b
diff --git a/electron/commands/image-upscayl.ts b/electron/commands/image-upscayl.ts
index f330171..c0fff02 100644
--- a/electron/commands/image-upscayl.ts
+++ b/electron/commands/image-upscayl.ts
@@ -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