mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Merge pull request #2371 from omnivore-app/fix/api-saving-request-query
Use normalized URLs when querying article saving requests
This commit is contained in:
commit
3b42a2b715
1 changed files with 10 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
|||
/* eslint-disable prefer-const */
|
||||
import normalizeUrl from 'normalize-url'
|
||||
import { getPageByParam } from '../../elastic/pages'
|
||||
import { User } from '../../entity/user'
|
||||
import { getRepository } from '../../entity/utils'
|
||||
|
|
@ -73,9 +74,17 @@ export const articleSavingRequestResolver = authorized<
|
|||
if (!user) {
|
||||
return { errorCodes: [ArticleSavingRequestErrorCode.Unauthorized] }
|
||||
}
|
||||
|
||||
const normalizedUrl = url
|
||||
? normalizeUrl(url, {
|
||||
stripHash: true,
|
||||
stripWWW: false,
|
||||
})
|
||||
: undefined
|
||||
|
||||
const params = {
|
||||
_id: id || undefined,
|
||||
url: url || undefined,
|
||||
url: normalizedUrl,
|
||||
userId: claims.uid,
|
||||
state: [
|
||||
ArticleSavingRequestStatus.Succeeded,
|
||||
|
|
|
|||
Loading…
Reference in a new issue