Skip to content

Commit

Permalink
Fixed Windows FileName CBZ Metadata
Browse files Browse the repository at this point in the history
Fixed regression with cbz where path was used as name instead of filename on windows
  • Loading branch information
btpf committed Sep 12, 2023
1 parent 7c2a867 commit 0d4ef24
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/shared/scripts/TauriActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@ export const createBookInstance = async (bookUrl:string, bookHash:string, cbzLay
}else{

const book = epubjs()
const fileName = decodeURI((new URL(bookUrl.startsWith("http")? bookUrl:"file://" + bookUrl).pathname.split("/").pop() as string));

// Decodes in the case that the convertFileSrc was used
// But also works otherwise
const fileName = (decodeURI((new URL(bookUrl.startsWith("http")? bookUrl:"file://" + bookUrl).pathname))
.replaceAll("\\","/") // make windows paths work
.split("/").pop() as string) // Pop the file stem
.split(".")[0] // Get the file name without the extension

const convertedValue = await parser(bookUrl, bookHash, fileName, cbzLayout)
if(convertedValue == "error"){
console.log("Book loading cancelled")
Expand Down

0 comments on commit 0d4ef24

Please sign in to comment.