diff --git a/src/components/manifest/manifestConfig.js b/src/components/manifest/manifestConfig.js index d657378..c8a790e 100644 --- a/src/components/manifest/manifestConfig.js +++ b/src/components/manifest/manifestConfig.js @@ -173,20 +173,6 @@ export async function buildFilesForUpload(attachments = [], { onlyNew = false } filePayload.thumbavif = thumbBase64; } - const meta = {}; - if (attachment.thumbnail) { - meta.thumbnail = attachment.thumbnail; - } - if (attachment.text) { - meta.text = attachment.text; - } - if (attachment.parentPdfId) { - meta.parentPdfId = String(attachment.parentPdfId); - } - if (Object.keys(meta).length > 0) { - filePayload.meta = meta; - } - files.push(filePayload); } catch (err) { console.error('Fehler beim Konvertieren von Datei zu Base64:', err); @@ -283,24 +269,7 @@ export async function restoreAttachmentsFromApi(apiFiles = [], existingAttachmen } } - // 2. Check meta.thumbnail if thumbavif wasn't available - if (!thumbnail && apiFile.meta?.thumbnail) { - try { - const metaThumb = apiFile.meta.thumbnail; - if (typeof metaThumb === 'string') { - if (metaThumb.startsWith('data:') || metaThumb.startsWith('blob:')) { - thumbnail = metaThumb; - } else { - const thumbBlob = base64ToBlob(metaThumb, 'image/avif'); - thumbnail = URL.createObjectURL(thumbBlob); - } - } - } catch (metaThumbErr) { - console.error('Fehler beim Dekodieren von meta.thumbnail:', metaThumbErr); - } - } - - // 3. Fallback to existing matching attachment thumbnail + // 2. Fallback to existing matching attachment thumbnail const matchingExisting = existingMap.get(String(apiFile.id)) || existingMap.get(String(apiFile.fileId)) || @@ -317,8 +286,8 @@ export async function restoreAttachmentsFromApi(apiFiles = [], existingAttachmen ? matchingExisting.file : new File([''], placeholderName, { type: placeholderType }); - const text = apiFile.meta?.text || matchingExisting?.text || null; - const parentPdfId = apiFile.meta?.parentPdfId || matchingExisting?.parentPdfId || null; + const text = matchingExisting?.text || null; + const parentPdfId = matchingExisting?.parentPdfId || null; attachments.push({ id: apiFile.id, @@ -370,19 +339,10 @@ export function collectFilesForUpload(attachments = [], { onlyNew = false } = {} } } - const meta = {}; - if (attachment.parentPdfId) { - meta.parentPdfId = String(attachment.parentPdfId); - } - if (attachment.text) { - meta.text = String(attachment.text); - } - files.push({ file: fileToUpload, name: attachment.name || fileToUpload.name, mimetype: attachment.type || fileToUpload.type, - meta: Object.keys(meta).length > 0 ? meta : undefined, }); } return files; @@ -426,14 +386,6 @@ export async function buildManifestBody( const isUpdate = !requireAtLeastOne; const filesToUpload = collectFilesForUpload(form.attachments, { onlyNew: isUpdate }); if (filesToUpload.length > 0) { - const filesMeta = filesToUpload - .filter((f) => f.meta) - .map((f) => ({ name: f.name, meta: f.meta })); - - if (filesMeta.length > 0) { - body.filesMeta = filesMeta; - } - const formData = new FormData(); formData.append('data', JSON.stringify(body)); for (const item of filesToUpload) { diff --git a/src/pages/lieferung/neu.jsx b/src/pages/lieferung/neu.jsx index bf9a271..08eedef 100644 --- a/src/pages/lieferung/neu.jsx +++ b/src/pages/lieferung/neu.jsx @@ -569,10 +569,13 @@ class LieferungNeuPage extends PureComponent { handleAttachmentClick(attachment) { if (!attachment) return; + const isPdf = + attachment.type === 'application/pdf' || + attachment.name?.toLowerCase().endsWith('.pdf'); const isText = - attachment.type?.startsWith('text/') || - attachment.name?.toLowerCase().endsWith('.txt') || - Boolean(attachment.text); + !isPdf && + (attachment.type?.startsWith('text/') || + attachment.name?.toLowerCase().endsWith('.txt')); if (isText) { this.setState({