Skip to content

Commit 7ae12df

Browse files
authored
fix(amazonq): normalize path for /doc scope (aws#6823)
## Problem On Windows, if a /doc user changes a folder to a nested subfolder more than one level below the workspace level, the folderPath sent to the API includes backslashes, which results in a `The folder you chose did not contain any source files` error. ## Solution Normalize folderPath before making API request --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 4b20c5a commit 7ae12df

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
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 Chat: Choosing a nested subfolder for `/doc` on Windows results in `The folder you chose did not contain any source files` error"
4+
}

packages/core/src/amazonqDoc/controllers/chat/controller.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import { getPathsFromZipFilePath, SvgFileExtension } from '../../../amazonq/util
4545
import { FollowUpTypes } from '../../../amazonq/commons/types'
4646
import { DocGenerationTask, DocGenerationTasks } from '../docGenerationTask'
4747
import { DevPhase } from '../../types'
48+
import { normalize } from '../../../shared/utilities/pathUtils'
4849

4950
export interface ChatControllerEventEmitters {
5051
readonly processHumanChatMessage: EventEmitter<any>
@@ -160,7 +161,9 @@ export class DocController {
160161
// Display path should always include workspace folder name
161162
displayPath = path.join(relativePath.workspaceFolder.name, relativePath.relativePath)
162163
// Only include workspace folder name in API call if multi-root workspace
163-
docGenerationTask.folderPath = isMultiRootWorkspace() ? displayPath : relativePath.relativePath
164+
docGenerationTask.folderPath = normalize(
165+
isMultiRootWorkspace() ? displayPath : relativePath.relativePath
166+
)
164167

165168
if (!relativePath.relativePath) {
166169
docGenerationTask.folderLevel = 'ENTIRE_WORKSPACE'

0 commit comments

Comments
 (0)