Update ESLint rules and resolve bot review feedback #8

Merged
AlexKucera merged 24 commits from obsidian-bot-review into master 2025-11-09 12:06:31 +01:00
Showing only changes of commit 7314776057 - Show all commits
+5 -3
View File
1
@@ -106,9 +106,11 @@ export class GeneralSection implements ModalSection {
// Validate output folder
if (this.outputFolderInput) {
coderabbitai[bot] commented 2025-11-05 19:26:59 +01:00 (Migrated from github.com)
Review

⚠️ Potential issue | 🟠 Major

Inconsistent path handling between onChange and validate.

The onChange handler preserves absolute paths (line 85), but the validate() method always normalizes paths including absolute ones (line 109). This inconsistency could cause validation to incorrectly handle absolute paths that were previously accepted.

Apply this diff to make validation consistent:

 		// Validate output folder
 		if (this.outputFolderInput) {
-			const value = normalizePath(this.outputFolderInput.value.trim());
+			const rawValue = this.outputFolderInput.value.trim();
+			const value = rawValue.startsWith('/') ? rawValue : normalizePath(rawValue);
 			if (!SecurityUtils.validateOutputPath(value)) {
 				errors.push(SecurityUtils.getPathValidationError(value));
 			}
 		}

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/ui/modal/sections/GeneralSection.ts around lines 84-86 and 109,
validation is inconsistent: onChange preserves absolute paths but validate()
always normalizes them. Update validate() to mirror onChange by checking
path.isAbsolute(value) and using the raw value for absolute paths, otherwise
passing normalizePath(value); then run the existing validation logic against
that normalizedValue so absolute paths are treated consistently between onChange
and validate.

✅ Addressed in commits f0daebc to c1c02ee

_⚠️ Potential issue_ | _🟠 Major_ **Inconsistent path handling between onChange and validate.** The onChange handler preserves absolute paths (line 85), but the validate() method always normalizes paths including absolute ones (line 109). This inconsistency could cause validation to incorrectly handle absolute paths that were previously accepted. Apply this diff to make validation consistent: ```diff // Validate output folder if (this.outputFolderInput) { - const value = normalizePath(this.outputFolderInput.value.trim()); + const rawValue = this.outputFolderInput.value.trim(); + const value = rawValue.startsWith('/') ? rawValue : normalizePath(rawValue); if (!SecurityUtils.validateOutputPath(value)) { errors.push(SecurityUtils.getPathValidationError(value)); } } ``` > Committable suggestion skipped: line range outside the PR's diff. <details> <summary>🤖 Prompt for AI Agents</summary> ``` In src/ui/modal/sections/GeneralSection.ts around lines 84-86 and 109, validation is inconsistent: onChange preserves absolute paths but validate() always normalizes them. Update validate() to mirror onChange by checking path.isAbsolute(value) and using the raw value for absolute paths, otherwise passing normalizePath(value); then run the existing validation logic against that normalizedValue so absolute paths are treated consistently between onChange and validate. ``` </details> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commits f0daebc to c1c02ee
const value = normalizePath(this.outputFolderInput.value.trim());
if (!SecurityUtils.validateOutputPath(value)) {
errors.push(SecurityUtils.getPathValidationError(value));
const rawValue = this.outputFolderInput.value.trim();
// Don't normalize absolute paths as normalizePath strips the leading slash
const normalizedValue = path.isAbsolute(rawValue) ? rawValue : normalizePath(rawValue);
if (!SecurityUtils.validateOutputPath(normalizedValue)) {
errors.push(SecurityUtils.getPathValidationError(normalizedValue));
}
}