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:
@@ -68,12 +68,11 @@ export default function ComposeScreen() {
|
||||
const insets = useSafeAreaInsets();
|
||||
const { workspaces, clients, isConfigured } = usePostiz();
|
||||
const queryClient = useQueryClient();
|
||||
const { prefillContent, prefillIntegrationIds, prefillImagePath, prefillImageId } =
|
||||
const { prefillContent, prefillIntegrationIds, prefillImages } =
|
||||
useLocalSearchParams<{
|
||||
prefillContent?: string;
|
||||
prefillIntegrationIds?: string;
|
||||
prefillImagePath?: string;
|
||||
prefillImageId?: string;
|
||||
prefillImages?: string;
|
||||
}>();
|
||||
|
||||
const [content, setContent] = useState("");
|
||||
@@ -95,12 +94,23 @@ export default function ComposeScreen() {
|
||||
if (prefillIntegrationIds) {
|
||||
setSelectedChannels(String(prefillIntegrationIds).split(",").filter(Boolean));
|
||||
}
|
||||
if (prefillImagePath && prefillImageId) {
|
||||
// Prefilled image has unknown workspace; associate with first workspace
|
||||
const wsId = workspaces[0]?.id ?? "";
|
||||
setMediaItems([{ type: "uploaded", id: String(prefillImageId), path: String(prefillImagePath), workspaceId: wsId }]);
|
||||
if (prefillImages && workspaces.length > 0) {
|
||||
try {
|
||||
const images: Array<{ id: string; path: string }> = JSON.parse(String(prefillImages));
|
||||
const wsId = workspaces[0]?.id ?? "";
|
||||
setMediaItems(
|
||||
images
|
||||
.filter((img) => img?.id && img?.path)
|
||||
.map((img): MediaItem => ({
|
||||
type: "uploaded",
|
||||
id: img.id,
|
||||
path: img.path,
|
||||
workspaceId: wsId,
|
||||
}))
|
||||
);
|
||||
} catch {}
|
||||
}
|
||||
}, [prefillContent, prefillIntegrationIds, prefillImagePath, prefillImageId, workspaces]);
|
||||
}, [prefillContent, prefillIntegrationIds, prefillImages, workspaces]);
|
||||
|
||||
useEffect(() => {
|
||||
if (prefillContent) return;
|
||||
|
||||
Reference in New Issue
Block a user