[PR #2141] [MERGED] refactor: simplify all those image urls and paths #2103

Closed
opened 2026-02-26 03:33:17 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/koel/koel/pull/2141
Author: @phanan
Created: 10/21/2025
Status: Merged
Merged: 10/21/2025
Merged by: @phanan

Base: masterHead: path-url


📝 Commits (1)

  • 1bb173a refactor: simplify all those image urls and paths

📊 Changes

38 files changed (+115 additions, -212 deletions)

View changed files

📝 app/Helpers.php (+4 -4)
📝 app/Http/Controllers/API/AlbumCoverController.php (+1 -1)
📝 app/Http/Controllers/API/Artist/ArtistImageController.php (+1 -1)
📝 app/Http/Controllers/API/FetchAlbumThumbnailController.php (+3 -1)
📝 app/Http/Controllers/API/PlaylistCoverController.php (+1 -1)
📝 app/Http/Resources/AlbumResource.php (+1 -1)
📝 app/Http/Resources/ArtistResource.php (+1 -1)
📝 app/Http/Resources/PlaylistResource.php (+1 -1)
📝 app/Http/Resources/RadioStationResource.php (+1 -1)
📝 app/Http/Resources/SongResource.php (+1 -1)
📝 app/Models/Album.php (+8 -46)
📝 app/Models/Artist.php (+2 -28)
📝 app/Models/Playlist.php (+1 -17)
📝 app/Models/RadioStation.php (+1 -18)
📝 app/Observers/AlbumObserver.php (+4 -4)
📝 app/Observers/ArtistObserver.php (+1 -1)
📝 app/Observers/PlaylistObserver.php (+1 -1)
📝 app/Observers/RadioStationObserver.php (+1 -9)
📝 app/Services/EncyclopediaService.php (+2 -2)
📝 app/Services/ImageStorage.php (+36 -32)

...and 18 more files

📄 Description

Description

Remove the "smart" URl and path attributes for image fields on artist, album, playlist, etc. Instead, use explicit functions (image_storage_url() and image_storage_path()) to turn the field values (file names) into URLs and paths only when necessary, e.g. in HTTP resources.

Motivation

Screenshots (if applicable)

Checklist

  • I've tested my changes thoroughly and added tests where applicable
  • I've updated relevant documentation (if any)
  • My code follows the project's conventions

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/koel/koel/pull/2141 **Author:** [@phanan](https://github.com/phanan) **Created:** 10/21/2025 **Status:** ✅ Merged **Merged:** 10/21/2025 **Merged by:** [@phanan](https://github.com/phanan) **Base:** `master` ← **Head:** `path-url` --- ### 📝 Commits (1) - [`1bb173a`](https://github.com/koel/koel/commit/1bb173a4158f27228f4b95bb076abe1f6de43ec6) refactor: simplify all those image urls and paths ### 📊 Changes **38 files changed** (+115 additions, -212 deletions) <details> <summary>View changed files</summary> 📝 `app/Helpers.php` (+4 -4) 📝 `app/Http/Controllers/API/AlbumCoverController.php` (+1 -1) 📝 `app/Http/Controllers/API/Artist/ArtistImageController.php` (+1 -1) 📝 `app/Http/Controllers/API/FetchAlbumThumbnailController.php` (+3 -1) 📝 `app/Http/Controllers/API/PlaylistCoverController.php` (+1 -1) 📝 `app/Http/Resources/AlbumResource.php` (+1 -1) 📝 `app/Http/Resources/ArtistResource.php` (+1 -1) 📝 `app/Http/Resources/PlaylistResource.php` (+1 -1) 📝 `app/Http/Resources/RadioStationResource.php` (+1 -1) 📝 `app/Http/Resources/SongResource.php` (+1 -1) 📝 `app/Models/Album.php` (+8 -46) 📝 `app/Models/Artist.php` (+2 -28) 📝 `app/Models/Playlist.php` (+1 -17) 📝 `app/Models/RadioStation.php` (+1 -18) 📝 `app/Observers/AlbumObserver.php` (+4 -4) 📝 `app/Observers/ArtistObserver.php` (+1 -1) 📝 `app/Observers/PlaylistObserver.php` (+1 -1) 📝 `app/Observers/RadioStationObserver.php` (+1 -9) 📝 `app/Services/EncyclopediaService.php` (+2 -2) 📝 `app/Services/ImageStorage.php` (+36 -32) _...and 18 more files_ </details> ### 📄 Description <!-- Thank you for contributing to Koel! Please provide a clear description of your changes below. --> ## Description Remove the "smart" URl and path attributes for image fields on artist, album, playlist, etc. Instead, use explicit functions (`image_storage_url()` and `image_storage_path()`) to turn the field values (file names) into URLs and paths only when necessary, e.g. in HTTP resources. ## Motivation <!-- Explain why this change is necessary, e.g., if targeting an existing issue, link to it. --> ## Screenshots (if applicable) ## Checklist - [x] I've tested my changes thoroughly and added tests where applicable - [x] I've updated relevant documentation (if any) - [x] My code follows the project's conventions --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 03:33:17 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#2103
No description provided.