diff --git a/java/.classpath b/java/.classpath
index 4d0e78c3..6ae6616f 100644
--- a/java/.classpath
+++ b/java/.classpath
@@ -9,6 +9,7 @@
+
@@ -22,6 +23,7 @@
+
diff --git a/lib/views/logo.js b/lib/views/logo.js
index e4998c8f..7d5f0c23 100644
--- a/lib/views/logo.js
+++ b/lib/views/logo.js
@@ -1,10 +1,34 @@
const config = require('../config')
const path = require('path')
+const fs = require('fs')
function get (req, res) {
+ // Prefer logoFilename (full absolute path) if available
+ let logoFilename = config.get('logoFilename')
+
+ if (logoFilename && fs.existsSync(logoFilename)) {
+ // Use the absolute path directly
+ return res.sendFile(logoFilename)
+ }
+
+ // Fall back to instanceLogo (relative path)
+ let instanceLogo = config.get('instanceLogo')
+ if (!instanceLogo) {
+ return res.status(404).send('Logo not found')
+ }
+
+ // Remove leading slash if present, as res.sendFile with root option expects relative path
+ let relativePath = instanceLogo.startsWith('/') ? instanceLogo.substring(1) : instanceLogo
var dir = path.resolve(__dirname, '../../uploads')
- let logoFilename = config.get('instanceLogo')
- res.sendFile(logoFilename, { root: dir })
+ let fullPath = path.join(dir, relativePath)
+
+ // Check if file exists
+ if (!fs.existsSync(fullPath)) {
+ return res.status(404).send('Logo not found')
+ }
+
+ // Send the file using root option
+ res.sendFile(relativePath, { root: dir })
}
module.exports = get