Skip to content

Directory prefix provided with -P/--directory-prefix is not normalized correctly #324

Description

@rstreif

If a directory prefix is provided its path components are not normalized correctly, which in turn causes the function mkdir_path to fail. Examples:

-P ./downloads    works
-P ../downloads   works
-P ../../downloads does not work (Internal error: Unexpected relative path: '../..')
-P ./../downloads does not work (Internal error: Unexpected relative path: './..')
-P /home/user/downloads/../downloads does not work (Internal error: Unexpected relative path: '/home/user/downloads/..')

I would not expect, nor actually want, mkdir_path to create the path components of the directory prefix (only the patch components from a recursively downloaded directory tree).

IMHO, wget2 should use realpath (or equivalent) to obtain the canonicalized absolute path name, then check if the path exists, and if so, use it subsequently. If the path does not exist or is actually a file then it should abort.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions