File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { checkInternalAuth } from '@/lib/auth/hybrid'
77import { secureFetchWithValidation } from '@/lib/core/security/input-validation.server'
88import { generateRequestId } from '@/lib/core/utils/request'
99import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
10+ import { docNotReadyResponse } from '@/lib/uploads/utils/servable-file-response'
1011import { FileAccessDeniedError } from '@/app/api/files/authorization'
1112import { uploadFilesForTeamsMessage } from '@/tools/microsoft_teams/server-utils'
1213import type { GraphApiErrorResponse , GraphChatMessage } from '@/tools/microsoft_teams/types'
@@ -167,6 +168,8 @@ export const POST = withRouteHandler(async (request: NextRequest) => {
167168 if ( error instanceof FileAccessDeniedError ) {
168169 return NextResponse . json ( { success : false , error : 'File not found' } , { status : 404 } )
169170 }
171+ const notReady = docNotReadyResponse ( error )
172+ if ( notReady ) return notReady
170173 logger . error ( `[${ requestId } ] Error sending Teams channel message:` , error )
171174 return NextResponse . json (
172175 {
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { checkInternalAuth } from '@/lib/auth/hybrid'
77import { secureFetchWithValidation } from '@/lib/core/security/input-validation.server'
88import { generateRequestId } from '@/lib/core/utils/request'
99import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
10+ import { docNotReadyResponse } from '@/lib/uploads/utils/servable-file-response'
1011import { FileAccessDeniedError } from '@/app/api/files/authorization'
1112import { uploadFilesForTeamsMessage } from '@/tools/microsoft_teams/server-utils'
1213import type { GraphApiErrorResponse , GraphChatMessage } from '@/tools/microsoft_teams/types'
@@ -164,6 +165,8 @@ export const POST = withRouteHandler(async (request: NextRequest) => {
164165 if ( error instanceof FileAccessDeniedError ) {
165166 return NextResponse . json ( { success : false , error : 'File not found' } , { status : 404 } )
166167 }
168+ const notReady = docNotReadyResponse ( error )
169+ if ( notReady ) return notReady
167170 logger . error ( `[${ requestId } ] Error sending Teams chat message:` , error )
168171 return NextResponse . json (
169172 {
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { parseRequest } from '@/lib/api/server'
66import { checkInternalAuth } from '@/lib/auth/hybrid'
77import { generateRequestId } from '@/lib/core/utils/request'
88import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
9+ import { docNotReadyResponse } from '@/lib/uploads/utils/servable-file-response'
910import { FileAccessDeniedError } from '@/app/api/files/authorization'
1011import { sendSlackMessage } from '@/app/api/tools/slack/utils'
1112
@@ -72,6 +73,8 @@ export const POST = withRouteHandler(async (request: NextRequest) => {
7273 if ( error instanceof FileAccessDeniedError ) {
7374 return NextResponse . json ( { success : false , error : 'File not found' } , { status : 404 } )
7475 }
76+ const notReady = docNotReadyResponse ( error )
77+ if ( notReady ) return notReady
7578 logger . error ( `[${ requestId } ] Error sending Slack message:` , error )
7679 return NextResponse . json (
7780 {
You can’t perform that action at this time.
0 commit comments