Change: Using posix file paths, Change: njodb version bump, Change: Ignore directories and files starting with . #169

This commit is contained in:
advplyr 2021-11-06 17:26:44 -05:00
parent 36d7c04d21
commit 28ccd4e568
13 changed files with 201 additions and 196 deletions

View file

@ -136,18 +136,18 @@ class Book {
update(payload) {
var hasUpdates = false
// Normalize cover paths if passed
// Clean cover paths if passed
if (payload.cover) {
if (!payload.cover.startsWith('http:') && !payload.cover.startsWith('https:')) {
payload.cover = Path.normalize(payload.cover)
if (payload.coverFullPath) payload.coverFullPath = Path.normalize(payload.coverFullPath)
payload.cover = payload.cover.replace(/\\/g, '/')
if (payload.coverFullPath) payload.coverFullPath = payload.coverFullPath.replace(/\\/g, '/')
else {
Logger.warn(`[Book] "${this.title}" updating book cover to "${payload.cover}" but no full path was passed`)
}
}
} else if (payload.coverFullPath) {
Logger.warn(`[Book] "${this.title}" updating book full cover path to "${payload.coverFullPath}" but no relative path was passed`)
payload.coverFullPath = Path.normalize(payload.coverFullPath)
payload.coverFullPath = payload.coverFullPath.replace(/\\/g, '/')
}
for (const key in payload) {
@ -191,8 +191,8 @@ class Book {
updateCover(cover, coverFullPath) {
if (!cover) return false
if (!cover.startsWith('http:') && !cover.startsWith('https:')) {
cover = Path.normalize(cover)
this.coverFullPath = Path.normalize(coverFullPath)
cover = cover.replace(/\\/g, '/')
this.coverFullPath = coverFullPath.replace(/\\/g, '/')
} else {
this.coverFullPath = cover
}