Commit f40b3d54 authored by jan.koester's avatar jan.koester
Browse files

test

parent 512c87a7
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -110,7 +110,11 @@ var MediaBrowser = (function() {

        EditorApi.mediaListMedia(connId, albumId).then(function(resp) {
            var media = resp.media || [];
            var baseUrl = resp.blogUrl || '';
            // Extract just the origin (scheme+host) since URLs are absolute paths
            var baseUrl = '';
            if (resp.blogUrl) {
                try { baseUrl = new URL(resp.blogUrl).origin; } catch(e) { baseUrl = resp.blogUrl; }
            }
            _status.textContent = '';
            _grid.innerHTML = '';

@@ -139,8 +143,12 @@ var MediaBrowser = (function() {
            img.loading = 'lazy';
            // Create preview with width=150, height auto-calculated
            EditorApi.mediaCreatePreview(connId, item.id, 150, 0).then(function(prev) {
                var prevBase = baseUrl;
                if (prev.blogUrl) {
                    try { prevBase = new URL(prev.blogUrl).origin; } catch(e) { prevBase = prev.blogUrl; }
                }
                if (prev.url) {
                    img.src = (prev.blogUrl || baseUrl) + prev.url;
                    img.src = prevBase + prev.url;
                } else {
                    img.src = baseUrl + item.url;
                }