filestack / filestack-js

Official Javascript SDK for the Filestack API and content ingestion system.
https://www.filestack.com
MIT License
206 stars 76 forks source link

Feature Request: Support preview CSS as data url #459

Open jvnlwn opened 2 years ago

jvnlwn commented 2 years ago

Expected Behavior

Preview API supports using a data url as css.

Current Behavior

Currently, receiving an error:

validation error: invalid value format "data%253Atext%252Fcss%253Bbase64%252CYm9keSB7IGJhY2tncm91bmQ6IGJsdWUgfQ%253D%253D" for parameter css required by preview task (invalid format data%253Atext%252Fcss%253Bbase64%252CYm9keSB7IGJhY2tncm91bmQ6IGJsdWUgfQ%253D%253D)

Possible Solution

Filestack must be expecting a literal url. Preferably, Filestack would check if the url provided is a data url, and if so, handle accordingly.

For example, a data url can be used in a like so:

<link rel="stylesheet" type="text/css" href="data:text/css;base64,Ym9keSB7IGJhY2tncm91bmQ6IGJsdWUgfQ==" />

Here's a demo: https://codesandbox.io/s/dazzling-pine-cdksy?file=/src/index.js

Context

Some benefits of supporting css as data url:

Caveat

All that to say, filestack-js is merely creating an iframe and supplying the preview url as the src, so it is not at all responsible for how the css url is handled. Is there repository or other suitable place to submit this request?

For instance, hitting the preview url directly produces the same error: https://cdn.filestackcontent.com/preview=css:%22data%3Atext%2Fcss%3Bbase64%2CYm9keSB7IGJhY2tncm91bmQ6IGJsdWUgfQ%3D%3D%22/SGe380ViQ7W8efiX6sdG

Your Environment