﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
33253	Collectstatic fails when using ManifestStaticFilesStorage and specific Javascript file	Hervé Le Roy	Carlton Gibson	"{{{
python manage.py collectstatic --no-input
Post-processing 'rest_framework/docs/js/highlight.pack.js' failed!
}}}

'''Steps to reproduce the issue'''

Start a new project
{{{django-admin startproject mysite}}}

Install the following packages
{{{
Django==4.0b1
djangorestframework~=3.12
}}}

Add {{{rest_framework}}} to installed apps

Update {{{settings.py}}} to use ManifestStaticFilesStorage
{{{
STATIC_ROOT = BASE_DIR / 'static'
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
}}}

Run collecstatic
{{{
python manage.py collectstatic --no-input
Post-processing 'rest_framework/docs/js/highlight.pack.js' failed!

Traceback (most recent call last):
  File ""/home/Devs/Sandbox/django4/mysite/manage.py"", line 22, in <module>
    main()
  File ""/home/Devs/Sandbox/django4/mysite/manage.py"", line 18, in main
    execute_from_command_line(sys.argv)
  File ""/home/Devs/Sandbox/django4/venv/lib/python3.9/site-packages/django/core/management/__init__.py"", line 425, in execute_from_command_line
    utility.execute()
  File ""/home/Devs/Sandbox/django4/venv/lib/python3.9/site-packages/django/core/management/__init__.py"", line 419, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File ""/home/Devs/Sandbox/django4/venv/lib/python3.9/site-packages/django/core/management/base.py"", line 373, in run_from_argv
    self.execute(*args, **cmd_options)
  File ""/home/Devs/Sandbox/django4/venv/lib/python3.9/site-packages/django/core/management/base.py"", line 417, in execute
    output = self.handle(*args, **options)
  File ""/home/Devs/Sandbox/django4/venv/lib/python3.9/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py"", line 187, in handle
    collected = self.collect()
  File ""/home/Devs/Sandbox/django4/venv/lib/python3.9/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py"", line 134, in collect
    raise processed
  File ""/home/Devs/Sandbox/django4/venv/lib/python3.9/site-packages/django/contrib/staticfiles/storage.py"", line 321, in _post_process
    content = pattern.sub(converter, content)
  File ""/home/Devs/Sandbox/django4/venv/lib/python3.9/site-packages/django/contrib/staticfiles/storage.py"", line 207, in converter
    hashed_url = self._url(
  File ""/home/Devs/Sandbox/django4/venv/lib/python3.9/site-packages/django/contrib/staticfiles/storage.py"", line 144, in _url
    hashed_name = hashed_name_func(*args)
  File ""/home/Devs/Sandbox/django4/venv/lib/python3.9/site-packages/django/contrib/staticfiles/storage.py"", line 371, in _stored_name
    cache_name = self.clean_name(self.hashed_name(name))
  File ""/home/Devs/Sandbox/django4/venv/lib/python3.9/site-packages/django/contrib/staticfiles/storage.py"", line 106, in hashed_name
    raise ValueError(""The file '%s' could not be found with %r."" % (filename, self))
ValueError: The file 'rest_framework/docs/js/,constant:' could not be found with <django.contrib.staticfiles.storage.ManifestStaticFilesStorage object at 0x7f3aa1b7ebe0>.
}}}

It used to work with previous versions of ManifestStaticFilesStorage. Maybe a regression with the recent additions of ES Module support and Javascript source map support ?
 
"	Bug	closed	contrib.staticfiles	4.0	Release blocker	fixed	ManifestStaticFilesStorage	gilmrjc	Accepted	1	0	0	0	0	0
