Skip to content

Commit

Permalink
Use basename to verify collection is named as expected
Browse files Browse the repository at this point in the history
The problem was that some characters were being uri encoded on one side of the comparison but not the other

Using basename on both side of the comparison should cause both strings to undergo the same transformation

As long as both results are the same, then the validation passed
  • Loading branch information
TylerZeroMaster committed Jul 17, 2024
1 parent 1946d8a commit 708a7b8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server/src/model/book.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export class BookNode extends Fileish {
{
message: BookValidationKind.INVALID_BOOK_NAME,
nodesToLoad: I.Set(),
fn: () => this.absPath.endsWith(`${this.slug}.collection.xml`)
fn: () => this.pathHelper.basename(this.absPath) === this.pathHelper.basename(`${this.slug}.collection.xml`)
? I.Set()
: I.Set([NOWHERE])
}
Expand Down

0 comments on commit 708a7b8

Please sign in to comment.