pythongosssss / ComfyUI-Custom-Scripts

Enhancements & experiments for ComfyUI, mostly focusing on UI features
MIT License
1.38k stars 104 forks source link

Fix uri encoding for preview image #200

Closed Lawrr closed 4 months ago

Lawrr commented 4 months ago

Fixes https://github.com/pythongosssss/ComfyUI-Custom-Scripts/issues/197.

Problem is that ( and ) are not encoded when using encodeURIComponent. Have replaced it to use the encoding implementation from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent#encoding_for_rfc3986 instead which includes encoding the !, ', (, ), * characters.

Have tested this with the lora loader in chrome/firefox/edge with an image called !'().jpeg (no * because it cannot be used in windows filenames) and confirmed that it works.