diff --git a/packages/server/src/api/controllers/public/rows.ts b/packages/server/src/api/controllers/public/rows.ts index e73bcf9b49..4a3b255a36 100644 --- a/packages/server/src/api/controllers/public/rows.ts +++ b/packages/server/src/api/controllers/public/rows.ts @@ -1,6 +1,7 @@ import { default as rowController } from "../row" import { addRev } from "./utils" import { Row } from "../../../definitions/common" +import { convertBookmark } from "../../../utilities" // makes sure that the user doesn't need to pass in the type, tableId or _id params for // the call to be correct @@ -30,7 +31,7 @@ export async function search(ctx: any, next: any) { sort: sort.column, sortType: sort.type, sortOrder: sort.order, - bookmark, + bookmark: convertBookmark(bookmark), paginate, limit, query, diff --git a/packages/server/src/utilities/index.js b/packages/server/src/utilities/index.js index d1e277541a..221c2ff18b 100644 --- a/packages/server/src/utilities/index.js +++ b/packages/server/src/utilities/index.js @@ -151,3 +151,11 @@ exports.formatBytes = bytes => { } return `${size.toFixed(size < 10 && unit > 0 ? 1 : 0)}${units[unit]}` } + +exports.convertBookmark = bookmark => { + const IS_NUMBER = /^\d+\.?\d*$/ + if (typeof bookmark === "string" && bookmark.match(IS_NUMBER)) { + return parseFloat(bookmark) + } + return bookmark +}