verbb / icon-picker

A Craft CMS field to select SVG or font icons from a folder for use in your content.
Other
17 stars 8 forks source link

Adding %5C%5C before filename of local files #13

Closed elwesterno closed 1 year ago

elwesterno commented 5 years ago

Description

When using local files from icons directory they are all rendered with %5C%5C before filename. Because of the bad path, they're not rendered properly in admin panel or website.

Steps to reproduce

  1. Put file in icons directory.
  2. Try to render it.

Additional info

engram-design commented 5 years ago

Can you provide a bit more information, as I'm not seeing this. What's your path/url settings? What font files are you using (svgs, sprites, fonts, etc)?

elwesterno commented 5 years ago

It happens with all types of files. I'll show it on this example: Let's say i have "social_instagram_wh.svg" file in my icons folder. My settings: 'iconSetsPath' => CRAFT_BASE_PATH . '/public/assets/icons/', 'iconSetsUrl' => '/assets/icons/', Then when i try to select this icon in admin panel the img tag looks like this: <img src="assets/icons%5C%5Csocial_instagram_wh.svg" width="20" height="20"> I guess it's adding backslash and converting it into %5C%5C. Same happens when i try to render it in HTML of the website by myself.

engram-design commented 5 years ago

I'll double check this, seems that you're also on Windows?

elwesterno commented 5 years ago

Yes, Windows 10. Paths are probably ok because turning "%5C%5C" to "/" in DevTools resolve the issue.

Also, if this could help, getIconName() method returns correct filename.

engram-design commented 1 year ago

Fixed in 2.0.0