• Resolved zachurbanbird

    (@zachurbanbird)


    Howdy, I hope everyone’s day is going well.

    Whenever I generate static files for my build, I have encountered an issue where the file path is too long as a result of renamed images.

    The homepage contains a business logo which, when converted into html, does not display the logo’s PNG file on my local machine (the build was created using LocalWP on Windows 11). Upon inspection (the html was viewed in both FireFox and Edge, and neither displayed the image), I determined that the image is not displaying due to the (relative) file path being too long- I am told that Windows doesn’t handle file paths in excess of 260 characters very well. I discovered that the PNG file had been renamed to something much different then what I uploaded the file to WordPress, and the file’s name had about 60 additional random characters appended to its original name. When the name of the PNG was changed to something short like ‘Logo.png’ and the file path edited to match, the image displayed properly (‘logo.png’ was not the original name of the image file, so it was not an issue caused by referencing the wrong image/a nonexistent image/having the wrong file name).

    While I could leave it at that for this particular instance of the error, I have this same PNG file referenced throughout the website, and the file paths are all broken as a result. Additionally, updating the build and regenerating the static files would cause me to repair every instance of the logo every time the site updated.

    It seems to me that the solution should be to prevent this png’s file rename from being excessively long during static generation. Does anyone else have this issue? Is there a known solution?

    Plugins Used:
    -Simply Static
    -Elementor
    -Yoast SEO
    -Elementor Header & Footer Builder

    Settings:
    -built on LocalWP
    -Web server: Apache
    -PHP version: 8.3.0
    -Wordpress version: 6.5.3

    Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author patrickposner

    (@patrickposner)

    Hey @zachurbanbird,

    thanks for reaching out!

    Sadly, that’s an issue we have had for years and is super hard to fix.
    It happens inside one of our external dependencies (the UTF8 parser/converter), which seems to have trouble handling these files.

    Right now, there isn’t a straightforward solution besides shortening the file paths, but I will update this post once we figure out a way to handle that more reliably!

    Thread Starter zachurbanbird

    (@zachurbanbird)

    I understand, thanks for reaching out even after a few days! I was able to resolve the issue today (5/23/2024). Turns out, the issue was not with Simply Static.

    Posting for anyone else who may have a similar problem:

    The issue for me appeared to be dealing with Elementor actually, as when an image is resized using Elementor, that plugin will create a copy of the file with the exact dimensions during the resize. When this happens, Elementor appends several random characters to the end of the file to distinguish it from the original, which it also keeps.

    So in my case, the image was being renamed by Elementor, and then Simply Static was just going with what Elementor gave it. Elementor was being a little problematic there, but on my local machine I just moved the export to a lower nested folder which allowed the file path to be within the 260 character limit for Windows, and since the URL character limit over the internet is over 2000 characters, the image displays properly when on a live site. Ergo, I needed to work around Elementor’s naming scheme and accept a lower nested folder in my files (at least temporarily while troubleshooting).

    Thanks for being willing to check this out!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Static Generation creates File Names that are Too Long’ is closed to new replies.