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

fix: mutate.Extract path manipulation on Windows #2015

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Sep 20, 2024

  1. fix: mutate.Extract path manipulation on Windows

    `mutate.Extract` replaces `/` with `\` on Windows (even for non-Windows
    images) due to the use of `filepath.Clean()` and other functions
    (e.g., `filepath.Dir`) that ultimately call `filepath.Clean` on the
    result.
    This is typically not desired, since:
     - the flattened image would not be valid on Linux
     - Windows can handle `/` as a path separator, if the result is meant to
       be extracted on Windows
     - the conversion may be non-reversible in the edge case where the image
       contains a file name with `\`
    
    Add an `imageFS` interface to abstract away path manipulation operations
    (e.g., `Dir`, `Base`, `Clean`, `Join`), with the default case being
    `filepath.*`, but allows using `path.*` if extracting a non-Windows
    image on Windows.
    
    Note: extracting a Windows image on Linux is left as is, since neither
    `path` nor `filepath` will be able to appropriately handle the paths
    if the separator is `\`.
    
    Signed-off-by: Hamza El-Saawy <[email protected]>
    helsaawy committed Sep 20, 2024
    Configuration menu
    Copy the full SHA
    ceb2b6b View commit details
    Browse the repository at this point in the history