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

_sanitize_path fails on Python 3.12 #59

Closed
mpasternak opened this issue Feb 6, 2024 · 1 comment
Closed

_sanitize_path fails on Python 3.12 #59

mpasternak opened this issue Feb 6, 2024 · 1 comment

Comments

@mpasternak
Copy link

Traceback

    def _sanitize_path(filepath):
        try:
            path_root = Path(getattr(settings, 'SENDFILE_ROOT', None))
        except TypeError:
            raise ImproperlyConfigured('You must specify a value for SENDFILE_ROOT')
    
        filepath_obj = Path(filepath)
    
        # get absolute path
        # Python 3.5: Path.resolve() has no `strict` kwarg, so use pathmod from an
        # already instantiated Path object
>       filepath_abs = Path(filepath_obj._flavour.pathmod.normpath(str(path_root / filepath_obj)))
E       AttributeError: module 'posixpath' has no attribute 'pathmod'

Fix

  1. actions & readme needs updating so we start testing on 3.12
  2. code (obviously!) needs updating

Who?

I don't have a PR ready yet, this is a simple fix but some time needs to be spent. Currently I'm not working on this, but if anything changes I'll let you know.

Thanks for maintaining django-sendfile!

@moggers87
Copy link
Owner

Fixed in #60

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants