mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-17 16:50:22 +00:00
apply feedback
This commit is contained in:
parent
2321e221b8
commit
272b199dc9
1 changed files with 13 additions and 4 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import type { Request, Response } from 'express'
|
||||
import logger from '../logger.js'
|
||||
|
||||
/**
|
||||
* Returns the decrypted Dropbox OAuth tokens for the current session.
|
||||
|
|
@ -12,9 +13,12 @@ export default function bridgeTokens(req: Request, res: Response): void {
|
|||
// provider cannot be read here: `verifyToken` decrypts against this same param,
|
||||
// so a mismatched path is rejected by the middleware before reaching this point.
|
||||
if (req.params['providerName'] !== 'dropbox') {
|
||||
res
|
||||
.status(400)
|
||||
.json({ error: 'The bridge-tokens endpoint only supports Dropbox.' })
|
||||
logger.warn(
|
||||
`bridge-tokens called for unsupported provider: ${req.params['providerName']}`,
|
||||
'bridge-tokens',
|
||||
req.id,
|
||||
)
|
||||
res.status(400).end()
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -22,7 +26,12 @@ export default function bridgeTokens(req: Request, res: Response): void {
|
|||
if (session?.accessToken == null) {
|
||||
// The auth token decrypted fine, but this session has no connected Dropbox
|
||||
// account — that is "not found", not an authentication failure.
|
||||
res.status(404).json({ error: 'No Dropbox tokens for this session.' })
|
||||
logger.info(
|
||||
'bridge-tokens: no Dropbox tokens for this session',
|
||||
'bridge-tokens',
|
||||
req.id,
|
||||
)
|
||||
res.status(404).end()
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue