Alinear los adjuntos JPG/JPEG de AiScan con el flujo privado de MyFiles de FacturaScripts#29
Conversation
FacturaScripts Playground Preview
Try this PR in your browser This preview is generated automatically for the |
5255007 to
a41f91e
Compare
JPG/JPEG attachments imported by AiScan failed to open through the private 'myft' URL while manually uploaded PDFs worked (#28). The cause was that AiScan registered the AttachedFile pointing into the 'aiscan_tmp' subfolder instead of staging the file at the MyFiles root like the core upload flow. Now AttachmentService moves the staged file to the MyFiles root (with collision-safe naming) and lets AttachedFile relocate it to the standard dated folder, so imported images behave exactly like manual uploads. The original file name is preserved as a friendly AttachedFile filename, and a failed save cleans up the staged file. Also documents the hosting-side checks (LiteSpeed cache, myft query param) for cases where the failure is outside the plugin.
a41f91e to
88246df
Compare
|
Recomendación tras la revisión a fondo: Es seguro de mezclar y aporta mejora real: nombres de fichero limpios (antes el Pero no cuentes con que cierre #28. Validándolo con tests sobre la clase real |
…S.md (#54) - Document the live upload -> AI extraction -> review -> import flow (make up, port, login, provider selection, fixtures) so the merged features can be exercised against a real provider, mirroring the ScheduledMail recipe. - Add Test/e2e-smoke.php: a non-interactive helper that runs the extraction + map + import path over the fixtures and reports invoice/attachment/warnings. - Fix outdated CI matrix references (8.1-8.4 -> 8.1-8.5 after the 8.5 addition). - Exclude the dev-only smoke helper from PHPCS, like the other Test/ scripts. No functional defects were found end-to-end testing today's merged PRs (#27 keyboard nav, #29 image attachments, #46 stock/purchase data, #48 payment method, #41 localized warnings, #31 tax-inclusive receipts); this PR only adds the validation guide, the smoke helper and the doc fixes.
Resuelve el #28: los adjuntos JPG/JPEG importados por AiScan fallaban al abrirse con la URL privada
myft(El token de acceso ... no es válido o ha caducado), mientras que los PDF subidos manualmente sí funcionaban.Causa
AiScan registraba el
AttachedFileapuntando a la subcarpetaMyFiles/aiscan_tmp/, en lugar de preparar el fichero en la raíz deMyFiles/como hace el flujo de subida del core de FacturaScripts. Esa diferencia de ruta provocaba que el servido privado por token funcionara distinto entre las imágenes de AiScan y los adjuntos manuales.Qué hace
AttachmentServiceahora alinea el adjunto con el flujo del core:MyFiles/con nombres a prueba de colisiones (fichero_1.jpg, etc.).AttachedFilelo reubique en la carpeta fechada estándar (MyFiles/2026/05/…), igual que una subida manual.filenameamigable delAttachedFile.Así, las imágenes importadas se comportan exactamente como los adjuntos manuales y la URL
myftfunciona igual para JPG/JPEG que para PDF. Documenta además las comprobaciones del lado del hosting (caché de LiteSpeed, conservación del parámetromyft) por si el fallo es externo al plugin.Relación con #36 / #39
Como efecto colateral, los adjuntos dejan de aparecer bajo
aiscan_tmp/y pasan a las carpetas fechadas estándar deMyFiles/, por lo que también resuelve la petición del #36 (evitar el confusoaiscan_tmp). Por eso esta solución sustituye al #39 (que solo renombraba la carpeta sin arreglar el problema real de las imágenes): se cierra el #39 en favor de este PR.Verificación
AttachmentService(colisiones, saneamiento de nombre, nombre amigable).Relates to #28 (se mantiene abierto hasta confirmar si el fallo residual es de hosting)