fix(mobile): restore images on repost, improve media library 404 error, null-safe stripHtml
Release APK / build (push) Has been cancelled
Release APK / build (push) Has been cancelled
- Pass post.image[] as JSON prefillImages param when prefilling compose from an existing post (repost/edit/retry), replacing the broken single-image prefillImagePath/prefillImageId approach - MediaLibraryModal now shows the attempted URL and a clear explanation on 404, making it easier to diagnose if the Postiz version does not expose GET /media - stripHtml accepts null/undefined input and returns "" instead of throwing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -66,12 +66,20 @@ export function MediaLibraryModal({ visible, workspaces, defaultWorkspaceId, max
|
||||
if (!activeWorkspace) return;
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
const url = `${activeWorkspace.baseUrl}/media`;
|
||||
try {
|
||||
// eslint-disable-next-line no-undef
|
||||
const res = await globalThis.fetch(`${activeWorkspace.baseUrl}/media`, {
|
||||
const res = await globalThis.fetch(url, {
|
||||
headers: { Authorization: activeWorkspace.apiKey },
|
||||
});
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||
if (!res.ok) {
|
||||
if (res.status === 404) {
|
||||
throw new Error(
|
||||
`Media listing endpoint not found (404).\nURL tried: ${url}\n\nThis feature requires Postiz to expose GET /media in its public API. Your version may not support it yet.`
|
||||
);
|
||||
}
|
||||
throw new Error(`HTTP ${res.status} — ${url}`);
|
||||
}
|
||||
const data = await res.json();
|
||||
const list: RawMediaItem[] = Array.isArray(data)
|
||||
? data
|
||||
|
||||
Reference in New Issue
Block a user