Skip to content

A self-hosted media server and file management system

fix: handle storage url needs to return null

aminnausin9eda4a3a297d
diff --git a/resources/js/components/video/VideoPlayer.vue b/resources/js/components/video/VideoPlayer.vue
index 0cee5cc3..a933a5fc 100755
--- a/resources/js/components/video/VideoPlayer.vue
+++ b/resources/js/components/video/VideoPlayer.vue
@@ -1108,7 +1108,7 @@ defineExpose({
`${isShowingControls ? 'cursor-auto' : 'cursor-none'}`,
]"
:src="stateVideo?.path ? encodeURIComponent(`../${stateVideo.path}`) : ''"
- :poster="isAudio ? audioPoster : handleStorageURL(stateVideo.metadata?.poster_url)"
+ :poster="isAudio ? audioPoster : (handleStorageURL(stateVideo.metadata?.poster_url) ?? '')"
@play="isPaused = false"
@pause="isPaused = true"
@ended="onPlayerEnded"
diff --git a/resources/js/service/util.ts b/resources/js/service/util.ts
index 6e9de2ce..bc28a436 100644
--- a/resources/js/service/util.ts
+++ b/resources/js/service/util.ts
@@ -180,8 +180,8 @@ export function within24Hrs(date: string): boolean {
* @param url The storage URL string.
* @returns The storage URL string with the correct protocol.
*/
-export function handleStorageURL(url: string | undefined): string {
- if (!url) return '';
+export function handleStorageURL(url: string | undefined): string | null {
+ if (!url) return null;
if (window.location.protocol === 'http:' && url.startsWith(`https://${window.location.host}`)) return url.replace('https:', 'http:');