Skip to content

Commit 33b791e

Browse files
authored
fix(amazonq): /dev to support upload of nested Dockerfiles aws#6115
## Problem Nested `Dockerfile` files were not supported with aws#6107 ## Solution Look at path basename when comparing file to list of well known files.
1 parent 7996a0b commit 33b791e

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Amazon Q /dev not adding Dockerfiles in nested folders"
4+
}

packages/core/src/shared/filetypes.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -348,16 +348,11 @@ export const codefileExtensions = new Set([
348348
'.zig',
349349
])
350350

351-
// Some well-known code files without an extension
352-
export const wellKnownCodeFiles = new Set(['Dockerfile', 'Dockerfile.build'])
351+
// Code file names without an extension
352+
export const codefileNames = new Set(['Dockerfile', 'Dockerfile.build'])
353353

354354
/** Returns true if `filename` is a code file. */
355355
export function isCodeFile(filename: string): boolean {
356-
if (codefileExtensions.has(path.extname(filename).toLowerCase())) {
357-
return true
358-
} else if (wellKnownCodeFiles.has(filename)) {
359-
return true
360-
} else {
361-
return false
362-
}
356+
const ext = path.extname(filename).toLowerCase()
357+
return codefileExtensions.has(ext) || codefileNames.has(path.basename(filename))
363358
}

0 commit comments

Comments
 (0)