Skip to content

Commit

Permalink
try: fix bugs in function IsNumber() using
Browse files Browse the repository at this point in the history
  • Loading branch information
BANKA2017 committed Jul 28, 2024
1 parent dadd1e6 commit 3540b0e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libs/core/Core.fetch.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1628,7 +1628,7 @@ const uploadMedia = async (ctx = { cookie: {}, media: null, type: 'INIT', media_
//cookie: {ct0, auth_token}
if (!cookie.ct0 || !cookie.auth_token) {
}
if ((['APPEND', 'INIT'].includes(type) && !media) || (['FINALIZE', 'STATUS', 'APPEND'].includes(type) && (!media_id || IsNumber(media_id, true, true)))) {
if ((['APPEND', 'INIT'].includes(type) && !media) || (['FINALIZE', 'STATUS', 'APPEND'].includes(type) && !IsNumber(media_id, true, true))) {
return Promise.reject({ code: -1003, message: `miss ${['FINALIZE', 'STATUS', 'APPEND'].includes(type) ? 'media id' : 'media buffer'}`, e: {} })
} else {
let queryObject = new URLSearchParams({
Expand Down
2 changes: 1 addition & 1 deletion libs/core/Core.function.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ const GetEntitiesFromText = (text = '', type = 'description') => {
}

const VerifyQueryString = (value, defaultValue) => {
if (!value || typeof value === 'object' || ((typeof defaultValue === 'number' || typeof defaultValue === 'bigint') && IsNumber(value, false, false))) {
if (!value || typeof value === 'object' || ((typeof defaultValue === 'number' || typeof defaultValue === 'bigint') && !IsNumber(value, false, false))) {
return defaultValue
}

Expand Down
2 changes: 1 addition & 1 deletion libs/core/Core.tweet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1396,7 +1396,7 @@ const SnowFlake2Time = (snowflake, start = 1288834974657) => {
server_id: 0,
datacenter_id: 0
}
if (IsNumber(snowflake, true, true)) {
if (!IsNumber(snowflake, true, true)) {
return tmpData
}
if (typeof snowflake === 'string' || typeof snowflake === 'number') {
Expand Down

0 comments on commit 3540b0e

Please sign in to comment.