Skip to content

Canonical paths should be used when checking if two Paths or Files point to the same place #199

Description

@Brycey92

I was looking through the source for the launcher and found that when File::equals(File) is called, it just does a comparison on the Paths from the Files which is implemented as file1.getPath().compareToIgnoreCase(file2.getPath()). Anywhere else in the launcher code that compares Paths without first converting to canonical is subject to the issue as well.

For example, comparing /foo/bar/ and /foo/../foo/bar/ would currently give a false-negative when checked for equality in the above two styles, potentially resulting in data loss such as here:
https://github.com/TechnicPack/LauncherV3/blob/master/src/main/java/net/technicpack/autoupdate/tasks/MoveLauncherPackage.java#L63

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions