Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preload Links handling .mp4 #7200

Open
worldwildweb opened this issue Dec 20, 2024 · 0 comments
Open

Preload Links handling .mp4 #7200

worldwildweb opened this issue Dec 20, 2024 · 0 comments

Comments

@worldwildweb
Copy link
Contributor

Describe the bug
When the Preload Links option is enabled, hovering over a link containing .mp4 in the href causes a 404 error in the browser console.

Example error:

GET https://wpr.willychataigner.com/wp-content/uploads/2024/12/metaplan-5-jahre-1080p30f.mp4/ net::ERR_ABORTED 404 (Not Found)

Example HTML causing the issue:

<a class="" href="https://wpr.willychataigner.com/wp-content/uploads/2024/12/metaplan-5-jahre-1080p30f.mp4">link</a>

This behavior is also reproducible with .mp3 files and possibly other unsupported extensions.

To Reproduce
Steps to reproduce the behavior:

  1. Enable the Preload Links module.
  2. Add an <a> tag with an href pointing to an internal .mp4 file to a page or post.
  3. Hover over the link.
  4. Observe the 404 error in the browser console.

Expected behavior
Links pointing to unsupported file types (e.g., .mp4, .mp3) should be excluded from preloading, similar to how other file extensions are already excluded.

Screenshots
If applicable, provide screenshots showing the issue.

Desktop (please complete the following information):

  • OS: [e.g., Windows 10]
  • Browser: [e.g., Chrome 119]
  • Version: [e.g., 119.0.0]

Smartphone (please complete the following information):

  • Device: [e.g., iPhone 12]
  • OS: [e.g., iOS 17.1]
  • Browser: [e.g., Safari]
  • Version: [e.g., 17.1]

Additional context

  • The exclusion logic for file extensions in the Preload Links module can be found here:
    [[Subscriber.php, line 135]https://github.com/wp-media/wp-rocket/blob/9acceaecbf5cf13da5502fd4ef3f1c95210a689c/inc/Engine/Preload/Links/Subscriber.php#L135)]
    $images_ext = 'jpg|jpeg|gif|png|tiff|bmp|webp|avif|pdf|doc|docx|xls|xlsx|php';
    )
  • Current exclusions include:
    $images_ext = 'jpg|jpeg|gif|png|tiff|bmp|webp|avif|pdf|doc|docx|xls|xlsx|php';
  • .mp4 and other media files (e.g., .mp3) are not included in the list and should be considered for exclusion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant