fix: JSON serialize favicon and logo URLs for PostgreSQL storage
Fixes #84 The favicon and logo upload endpoints were storing URL paths directly without JSON.stringify(), causing PostgreSQL JSON validation errors ("Token '/' is invalid") since paths like "/uploads/favicons/..." are not valid JSON. Applied JSON.stringify() to: - branding_logo_url setting (lines 358, 364) - branding_favicon_url setting (lines 894, 900)
This commit is contained in:
@@ -355,13 +355,13 @@ router.post('/logo', adminAuth, requirePermission('settings.edit'), upload.singl
|
|||||||
await db('app_settings')
|
await db('app_settings')
|
||||||
.insert({
|
.insert({
|
||||||
setting_key: 'branding_logo_url',
|
setting_key: 'branding_logo_url',
|
||||||
setting_value: publicPath,
|
setting_value: JSON.stringify(publicPath),
|
||||||
setting_type: 'branding',
|
setting_type: 'branding',
|
||||||
updated_at: new Date()
|
updated_at: new Date()
|
||||||
})
|
})
|
||||||
.onConflict('setting_key')
|
.onConflict('setting_key')
|
||||||
.merge({
|
.merge({
|
||||||
setting_value: publicPath,
|
setting_value: JSON.stringify(publicPath),
|
||||||
updated_at: new Date()
|
updated_at: new Date()
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -891,13 +891,13 @@ router.post('/favicon', adminAuth, requirePermission('settings.edit'), faviconUp
|
|||||||
await db('app_settings')
|
await db('app_settings')
|
||||||
.insert({
|
.insert({
|
||||||
setting_key: 'branding_favicon_url',
|
setting_key: 'branding_favicon_url',
|
||||||
setting_value: faviconUrl,
|
setting_value: JSON.stringify(faviconUrl),
|
||||||
setting_type: 'branding',
|
setting_type: 'branding',
|
||||||
updated_at: new Date()
|
updated_at: new Date()
|
||||||
})
|
})
|
||||||
.onConflict('setting_key')
|
.onConflict('setting_key')
|
||||||
.merge({
|
.merge({
|
||||||
setting_value: faviconUrl,
|
setting_value: JSON.stringify(faviconUrl),
|
||||||
updated_at: new Date()
|
updated_at: new Date()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user