Skip to content

Commit 4ee4e98

Browse files
author
Theodore Li
committed
Fix build issues
1 parent c1b729f commit 4ee4e98

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

apps/sim/app/api/files/utils.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { existsSync } from 'fs'
2-
import { join, resolve, sep } from 'path'
2+
import path from 'path'
33
import { createLogger } from '@sim/logger'
44
import { NextResponse } from 'next/server'
55
import { UPLOAD_DIR } from '@/lib/uploads/config'
@@ -155,7 +155,7 @@ function sanitizeFilename(filename: string): string {
155155
return sanitized
156156
})
157157

158-
return sanitizedSegments.join(sep)
158+
return sanitizedSegments.join(path.sep)
159159
}
160160

161161
export function findLocalFile(filename: string): string | null {
@@ -168,17 +168,18 @@ export function findLocalFile(filename: string): string | null {
168168
}
169169

170170
const possiblePaths = [
171-
join(UPLOAD_DIR, sanitizedFilename),
172-
join(process.cwd(), 'uploads', sanitizedFilename),
171+
path.join(UPLOAD_DIR, sanitizedFilename),
172+
path.join(process.cwd(), 'uploads', sanitizedFilename),
173173
]
174174

175-
for (const path of possiblePaths) {
176-
const resolvedPath = resolve(path)
177-
const allowedDirs = [resolve(UPLOAD_DIR), resolve(process.cwd(), 'uploads')]
175+
for (const filePath of possiblePaths) {
176+
const resolvedPath = path.resolve(filePath)
177+
const allowedDirs = [path.resolve(UPLOAD_DIR), path.resolve(process.cwd(), 'uploads')]
178178

179179
// Must be within allowed directory but NOT the directory itself
180180
const isWithinAllowedDir = allowedDirs.some(
181-
(allowedDir) => resolvedPath.startsWith(allowedDir + sep) && resolvedPath !== allowedDir
181+
(allowedDir) =>
182+
resolvedPath.startsWith(allowedDir + path.sep) && resolvedPath !== allowedDir
182183
)
183184

184185
if (!isWithinAllowedDir) {

apps/sim/tools/firecrawl/extract.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ export const extractTool: ToolConfig<ExtractParams, ExtractResponse> = {
150150
jobId: data.id,
151151
success: false,
152152
data: {},
153+
creditsUsed: 0,
153154
},
154155
}
155156
},

0 commit comments

Comments
 (0)