Skip to content

Object Store and Base64 to file conversion logic

Vignesh Devendran requested to merge base64-to-file-conversion-changes into main

#590 (closed) Object store

Incorporate coko/server file server changes

  • Additional config variables & env variables to enable the file server
  • New File model overwrites existing File model moving forward
  • Migration scripts to move existing files in uploads volume to file server
  • Refactor changes on both client and server for fetching and uploading files to file server
  • Refactor changes fix permissions based on the new file model

Submission

  • On uploading the .docx manuscript the xsweet provides us with images in Base64 format which are converted to the original image source and uploaded to the object-store. The variants of the converted file have three sizes original, medium, and small with format saved either as PNG/JPEG. Then the base64 string is replaced with a medium-sized file URL in the manuscript source HTML.

Wax & manuscript

  • added migration script to replace base64 in manuscript source HTML to object-store image URLs.
  • As the generated file URL by default expires in one day it's refreshed when the manuscript source is fetched from the server.
  • On insertion of base64 images from wax get converted to object storage images on manuscript update and URLs are replaced with medium-sized images (interim solution TODO: Wax asset manager).

Pagedjs

  • Tested Pagedjs issue pdf download with fileserver based images to identify & verify the inconsistency is caused by base64 images. Test results seem to indicate the inconsistency was caused by the google fonts imports and a different merge request implemented an interim solution.
  • Pagedjs now uses original quality images from the object store on download

Misc

  • Converted base64 file to webp logic experimented code
Edited by Vignesh Devendran

Merge request reports