mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-05-13 07:46:47 +00:00
fix: validate shared link refresh payload
This commit is contained in:
parent
23053f015a
commit
a5b7e07434
2 changed files with 6 additions and 1 deletions
|
|
@ -114,6 +114,10 @@ router.post('/:conversationId', requireJwtAuth, async (req, res) => {
|
|||
router.patch('/:shareId', requireJwtAuth, async (req, res) => {
|
||||
try {
|
||||
const { targetMessageId } = req.body ?? {};
|
||||
if (targetMessageId !== undefined && typeof targetMessageId !== 'string') {
|
||||
return res.status(400).json({ message: 'targetMessageId must be a string' });
|
||||
}
|
||||
|
||||
const updatedShare = await updateSharedLink(req.user.id, req.params.shareId, targetMessageId);
|
||||
if (updatedShare) {
|
||||
res.status(200).json(updatedShare);
|
||||
|
|
|
|||
|
|
@ -319,7 +319,8 @@ export type TSharedLinkResponse = Pick<TSharedLink, 'shareId'> &
|
|||
Pick<TSharedLink, 'targetMessageId'> &
|
||||
Pick<TConversation, 'conversationId'>;
|
||||
|
||||
export type TSharedLinkGetResponse = TSharedLinkResponse & {
|
||||
export type TSharedLinkGetResponse = Omit<TSharedLinkResponse, 'shareId'> & {
|
||||
shareId: string | null;
|
||||
success: boolean;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue