[Django] #37081: loaddata fails when a directory in the fixture path contains a dot

22 views
Skip to first unread message

Django

unread,
May 1, 2026, 5:42:26 PMMay 1
to django-...@googlegroups.com
#37081: loaddata fails when a directory in the fixture path contains a dot
-------------------------------------+-------------------------------------
Reporter: Alisson Silveira | Type: Bug
Status: new | Component: Core
| (Management commands)
Version: 6.0 | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
How to reproduce:

Create a fixture in a directory containing a dot, for example:
{{{
fixtures/fix.v1/data.json
}}}

Run (without specifying the file extension):
{{{
python manage.py loaddata fixtures/fix.v1/data
}}}

This raises:
{{{
CommandError: Problem installing fixture 'fixtures/fix': v1/data is not a
known serialization format.
}}}

This occurs when a directory in the fixture path contains a dot, as the
full path is incorrectly split on "." instead of operating on the file
name.

Expected behavior: Django should correctly determine the fixture format
based on the file name and load the fixture successfully, ignoring dots in
directory names.

A fix has been identified and will be submitted in a pull request.
--
Ticket URL: <https://code.djangoproject.com/ticket/37081>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 1, 2026, 6:05:11 PMMay 1
to django-...@googlegroups.com
#37081: loaddata fails when a directory in the fixture path contains a dot
-------------------------------------+-------------------------------------
Reporter: Alisson Silveira | Owner: Alisson
| Silveira
Type: Bug | Status: assigned
Component: Core (Management | Version: 6.0
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Alisson Silveira):

* owner: (none) => Alisson Silveira
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/37081#comment:1>

Django

unread,
May 1, 2026, 7:00:57 PMMay 1
to django-...@googlegroups.com
#37081: loaddata fails when a directory in the fixture path contains a dot
-------------------------------------+-------------------------------------
Reporter: Alisson Silveira | Owner: Alisson
| Silveira
Type: Bug | Status: assigned
Component: Core (Management | Version: 6.0
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Alisson Silveira):

* has_patch: 0 => 1

Comment:

Pull request: https://github.com/django/django/pull/21213
--
Ticket URL: <https://code.djangoproject.com/ticket/37081#comment:2>

Django

unread,
May 10, 2026, 9:39:47 AMMay 10
to django-...@googlegroups.com
#37081: loaddata fails when a directory in the fixture path contains a dot
-------------------------------------+-------------------------------------
Reporter: Alisson Silveira | Owner: Alisson
| Silveira
Type: Bug | Status: assigned
Component: Core (Management | Version: 6.0
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Gert Burger):

Tested this on stable/6.0.x and 5.2.11, as reported, if the fixture
extension is not specified then any other dot in the path will incorrectly
be considered the separator for the extension.
--
Ticket URL: <https://code.djangoproject.com/ticket/37081#comment:3>

Django

unread,
May 14, 2026, 5:07:30 AMMay 14
to django-...@googlegroups.com
#37081: loaddata fails when a directory in the fixture path contains a dot
-------------------------------------+-------------------------------------
Reporter: Alisson Silveira | Owner: Alisson
| Silveira
Type: Bug | Status: assigned
Component: Core (Management | Version: 6.0
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* stage: Unreviewed => Accepted

Comment:

Thank you! I think this is a bug worth addressing.
My only concern was whether this could create any path traversal issues
allowing something like `fixtures/../secret.json` but I think this would
be out of the scope of security issues anyway. See
https://docs.djangoproject.com/en/6.0/internals/security/#how-does-django-
evaluate-a-report
--
Ticket URL: <https://code.djangoproject.com/ticket/37081#comment:4>

Django

unread,
May 14, 2026, 5:07:49 AMMay 14
to django-...@googlegroups.com
#37081: loaddata fails when a directory in the fixture path contains a dot
-------------------------------------+-------------------------------------
Reporter: Alisson Silveira | Owner: Alisson
| Silveira
Type: Bug | Status: assigned
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* version: 6.0 => dev

--
Ticket URL: <https://code.djangoproject.com/ticket/37081#comment:5>

Django

unread,
May 14, 2026, 7:58:15 AMMay 14
to django-...@googlegroups.com
#37081: loaddata fails when a directory in the fixture path contains a dot
-------------------------------------+-------------------------------------
Reporter: Alisson Silveira | Owner: Alisson
| Silveira
Type: Bug | Status: assigned
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Alisson Silveira):

Replying to [comment:4 Sarah Boyce]:
> Thank you! I think this is a bug worth addressing.
> My only concern was whether this could create any path traversal issues
allowing something like `fixtures/../secret.json` but I think this would
be out of the scope of security issues anyway. See
https://docs.djangoproject.com/en/6.0/internals/security/#how-does-django-
evaluate-a-report

Thanks for your feedback, Sarah! I can provide a bit more context for the
record.

I decided to use a PurePath object to prevent any filesystem access, since
this method only needs to parse the filename. The filename is the only
piece of information being extracted and modified from the filepath. In
contrast, the current approach relies on rsplit() directly on the file
path string, which could potentially introduce security issues if the path
is manipulated. Using PurePath makes the intent clearer and provides safer
path handling.

Since this was a bug I encountered in a production system, my fix is
specifically focused on addressing that issue. However, I’d be more than
happy to address any additional fixes or improvements related to this area
if needed. Please let me know if you’d like me to explore any further
improvements here.
--
Ticket URL: <https://code.djangoproject.com/ticket/37081#comment:6>
Reply all
Reply to author
Forward
0 new messages