Opened 4 years ago

Closed 4 years ago

#32218 closed Bug (duplicate)

storage.StaticFilesStorage.post_process substitutes relative URLs in comments

Reported by: Gagan Deep Owned by: Gagan Deep
Component: contrib.staticfiles Version: dev
Severity: Normal Keywords: static
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

While using STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage' setting, the collectstatic command was always failing because it was not able to find a certain file. I am getting the following error:

ValueError: The file 'netjsongraph/css/lib/"images/ui-icons_555555_256x240.png"' could not be found with <django.contrib.staticfiles.storage.ManifestStaticFilesStorage object at 0x7f773b3be520>.

The peculiar thing to notice is the name of the missing file contains " . Initially I thought it might me an error in the CSS, but even after removing all CSS properties using url() functions, the error was still there.
The error disappeared only after I removed the comment in the CSS file which contained url(%22images%2Fui-icons_555555_256x240.png%22) as a parameter to some URL.

The post_process should not try to make substitutions for url keyword inside comments. Since it pattern matching is used to make substitutions, it will be better to process files without comments for pattern matching.

You can use this CSS file for reproducing this bug.

Change History (1)

comment:1 by Mariusz Felisiak, 4 years ago

Resolution: duplicate
Status: assignedclosed

Duplicate of #21080.

Note: See TracTickets for help on using tickets.
Back to Top