Skip to content

Commit

Permalink
fix chapter.page when containing special character (#1015)
Browse files Browse the repository at this point in the history
* fix page when containing special character

* page always defaults to 1

* AND page = ?
  • Loading branch information
K1ngfish3r authored Mar 26, 2024
1 parent 7ea8eba commit 9ef8cab
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/database/queries/ChapterQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,8 @@ export const insertChapters = async (
});
};

const getPageChaptersQuery = (
sort = 'ORDER BY position ASC',
filter = '',
page = '1',
) =>
`SELECT * FROM Chapter WHERE novelId = ? AND page = '${page}' ${filter} ${sort}`;
const getPageChaptersQuery = (sort = 'ORDER BY position ASC', filter = '') =>
`SELECT * FROM Chapter WHERE novelId = ? AND page = ? ${filter} ${sort}`;

export const getCustomPages = (
novelId: number,
Expand Down Expand Up @@ -108,8 +104,8 @@ export const getPageChapters = (
return new Promise(resolve =>
db.transaction(tx => {
tx.executeSql(
getPageChaptersQuery(sort, filter, page),
[novelId],
getPageChaptersQuery(sort, filter),
[novelId, page || '1'],
(txObj, { rows }) => resolve((rows as any)._array),
txnErrorCallback,
);
Expand Down

0 comments on commit 9ef8cab

Please sign in to comment.