mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-06 05:02:58 +03:00
[PR #965] [MERGED] fix: decouple images from app config service #542
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/pocket-id/pocket-id/pull/965
Author: @stonith404
Created: 9/19/2025
Status: ✅ Merged
Merged: 9/20/2025
Merged by: @stonith404
Base:
main← Head:refactor/application-images📝 Commits (6)
5c29b27refactor: decouple images from app config serviced11b6d9fix linter issuesd537a5cfix api paths6f6a744Update backend/internal/utils/file_util.go981ec24use filepath instead of pathd33298dMerge branch 'main' into refactor/application-images📊 Changes
19 files changed (+426 additions, -314 deletions)
View changed files
📝
backend/internal/bootstrap/app_images_bootstrap.go(+19 -41)➖
backend/internal/bootstrap/application_images_bootstrap_test.go(+0 -61)📝
backend/internal/bootstrap/bootstrap.go(+2 -2)📝
backend/internal/bootstrap/router_bootstrap.go(+4 -3)📝
backend/internal/bootstrap/services_bootstrap.go(+4 -1)📝
backend/internal/controller/app_config_controller.go(+0 -150)➕
backend/internal/controller/app_images_controller.go(+173 -0)📝
backend/internal/model/app_config.go(+1 -4)📝
backend/internal/service/app_config_service.go(+1 -38)➕
backend/internal/service/app_images_service.go(+82 -0)➕
backend/internal/service/app_images_service_test.go(+88 -0)📝
backend/internal/service/email_service.go(+1 -1)📝
backend/internal/utils/file_util.go(+10 -0)📝
backend/internal/utils/file_util_test.go(+28 -0)📝
frontend/src/app.html(+1 -1)📝
frontend/src/lib/services/app-config-service.ts(+3 -3)📝
frontend/src/lib/utils/cached-image-util.ts(+4 -4)📝
frontend/src/routes/settings/admin/application-configuration/update-application-images.svelte(+1 -1)📝
tests/specs/application-configuration.spec.ts(+4 -4)📄 Description
This PR separates the handling of application images (such as the logo and background) from the
AppConfigService. By decoupling this logic, the codebase becomes cleaner and avoids bugs caused by inconsistencies in file type management.Currently, Pocket ID stores the file extension of uploaded images in the database at the time of upload. If a user later replaces images directly on the filesystem, the stored extension can fall out of sync with the actual file, preventing the image from being displayed. A similar issue occurred in #964, where users had uploaded a custom JPG image. Since the last release changed the default background image format in
AppConfigServicefrom JPG to WEBP, Pocket ID incorrectly assumed those users were using a WEBP file instead of their actual JPG, which led to display problems.Closes #964
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.