diff --git a/lib/managers/docker.js b/lib/managers/docker.js index 01ae3fc05..35d6bef67 100644 --- a/lib/managers/docker.js +++ b/lib/managers/docker.js @@ -52,6 +52,10 @@ if ( // Taken from https://github.com/isaacs/node-tar/blob/main/src/strip-absolute-path.ts export const stripAbsolutePath = (path) => { + // This appears to be a most frequent case, so let's return quickly. + if (path === "/") { + return ""; + } let parsed = win32.parse(path); while (win32.isAbsolute(path) || parsed.root) { // windows will think that //x/y/z has a "root" of //x/y/ @@ -762,6 +766,8 @@ export const getImage = async (fullImageName) => { /** * Warnings such as TAR_ENTRY_INFO are treated as errors in strict mode. While this is mostly desired, we can relax this * requirement for one particular warning related to absolute paths. + * This callback function checks for absolute paths in the entry read from the archive and strips them using a custom + * method. * * @param entry {tar.ReadEntry} ReadEntry object from node-tar */ diff --git a/types/lib/managers/docker.d.ts b/types/lib/managers/docker.d.ts index dfb316d68..3e5a55ede 100644 --- a/types/lib/managers/docker.d.ts +++ b/types/lib/managers/docker.d.ts @@ -4,6 +4,7 @@ export function detectRancherDesktop(): any; export const isWin: boolean; export const DOCKER_HUB_REGISTRY: "docker.io"; +export function stripAbsolutePath(path: any): any; export function getDirs(dirPath: string, dirName: string, hidden?: boolean, recurse?: boolean): string[]; export function getOnlyDirs(srcpath: any, dirName: any): any; export function getConnection(options: any, forRegistry: any): Promise; diff --git a/types/lib/managers/docker.d.ts.map b/types/lib/managers/docker.d.ts.map index 043f5d7fc..44b1453f6 100644 --- a/types/lib/managers/docker.d.ts.map +++ b/types/lib/managers/docker.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../../../lib/managers/docker.js"],"names":[],"mappings":"AAoDA;;GAEG;AACH,4CA6CC;AAxED,4BAA6C;AAC7C,kCAAmC,WAAW,CAAC;AAkFxC,iCAHI,MAAM,WACN,MAAM,iDAehB;AAqBM,6DAmBN;AAgLM,4EAsGN;AAEM,oFAwBN;AAUM;;;;;;;;EAwEN;AAsBM,2DA6KN;AAEM,2EA4FN;AAMM;;;;;;;;;;;;;GAqDN;AAEM;;;;;;;GAqGN;AAMM,8DAqIN;AAKM,4EAmGN;AAEM,+EAMN;AAEM,4EAyCN;AAEM,iFA0BN"} \ No newline at end of file +{"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../../../lib/managers/docker.js"],"names":[],"mappings":"AAsEA;;GAEG;AACH,4CA6CC;AA1FD,4BAA6C;AAC7C,kCAAmC,WAAW,CAAC;AAwBxC,kDAeN;AA6DM,iCAHI,MAAM,WACN,MAAM,iDAehB;AAqBM,6DAmBN;AAgLM,4EAsGN;AAEM,oFAwBN;AAUM;;;;;;;;EAwEN;AAsBM,2DA6KN;AAgBM,2EA4FN;AAMM;;;;;;;;;;;;;GAqDN;AAEM;;;;;;;GAqGN;AAMM,8DAuIN;AAKM,4EAmGN;AAEM,+EAMN;AAEM,4EAyCN;AAEM,iFA0BN"} \ No newline at end of file