IMPORTANT : Fix wrong file metadata in DB & srcset path for SVG files
-
There is a major bug in this plugin.
The ‘file’ metadata of uploaded SVG files is incorrect in the database (‘wp_postmeta’ table filtered by meta_key = “_wp_attachment_metadata”), there is a slash at the beginning of the file name when there is none for other image formats (like jpg or png).
This poses a problem on the front of a website because the path defined in the “srcset” of SVG images is wrong and the SVG image may not display correctly on some servers which filter resource paths with two slashes.To resolve this problem, in the ‘svg-support/functions/attachment.php’ file, line 73, you need to replace:
$relative_path = str_replace($upload_dir['basedir'], '', $svg_path);
through :
$relative_path = str_replace(trailingslashit($upload_dir['basedir']), '', $svg_path);
(Or something like that). This is working for me, can you check on your end and add this fix to the next version of the add-on?
Thank you.
- The topic ‘IMPORTANT : Fix wrong file metadata in DB & srcset path for SVG files’ is closed to new replies.