Uploaded image for project: 'Nuxeo Drive '
  1. Nuxeo Drive
  2. NXDRIVE-2319

Do not use the undocumented and unreliable Path.absolute() method

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 4.1.0
    • Fix Version/s: 4.5.0
    • Component/s: Framework
    • Tags:
    • Sprint:
      nxDrive 11.2.6
    • Story Points:
      2

      Description

      Here is a thread showing several issues with the use of Path.absolute(). The method is not documented, and its behavior is not guaranted.

      Sadly, as of now, there is no equivalent of the os.path.abspath() function for Path objects.

      We should ensure to get rid of all calls to Path.absolute() and use that code instead:

      def absolutepath(path: Union[Path, str]) -> Path:
          """Convert a path to an absolute path using os.path.abspath.
          Prefer this over Path.resolve() (see #6523).
          Prefer this over Path.absolute() (not public, doesn't normalize).
          """
          return Path(os.path.abspath(str(path)))
      

        Attachments

        1. oft2unit.diff
          25 kB
          Mickaël Schoentgen

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 hours
                  4h