Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
423607ab
authored
Apr 28, 2026
by
Ryo
Committed by
GitHub
Apr 28, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: add skip file type check env (#6839)
parent
1cb67b38
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
packages/service/common/s3/validation/upload.ts
+9
-0
packages/service/env.ts
+6
-2
No files found.
packages/service/common/s3/validation/upload.ts
View file @
423607ab
...
...
@@ -4,6 +4,7 @@ import path from 'node:path';
import
type
{
UploadConstraints
}
from
'../contracts/type'
;
import
{
DEFAULT_CONTENT_TYPE
,
resolveMimeType
}
from
'../utils/mime'
;
import
{
normalizeAllowedExtensions
,
normalizeFileExtension
}
from
'../utils/uploadConstraints'
;
import
{
env
}
from
'../../../env'
;
const
defaultInspectBytes
=
8192
;
const
officeZipInspectBytes
=
64
*
1024
;
...
...
@@ -171,6 +172,14 @@ export async function validateUploadFile({
extension
,
uploadConstraints
});
if
(
env
.
SKIP_FILE_TYPE_CHECK
)
{
return
{
filename
:
normalizedFileName
,
contentType
:
expectedMime
};
}
const
detected
=
await
fileTypeFromBuffer
(
buffer
).
catch
((
error
)
=>
{
if
(
error
?.
name
===
'EndOfStreamError'
||
error
?.
message
===
'End-Of-Stream'
)
{
return
undefined
;
...
...
packages/service/env.ts
View file @
423607ab
import
{
createEnv
}
from
'@t3-oss/env-core'
;
import
z
from
'zod'
;
const
truthyBoolStrs
=
[
'true'
,
'1'
,
'yes'
,
'y'
];
const
BoolSchema
=
z
.
string
()
.
transform
((
val
)
=>
val
===
'true'
)
.
transform
((
val
)
=>
truthyBoolStrs
.
includes
(
val
.
toLowerCase
())
)
.
pipe
(
z
.
boolean
());
const
NumSchema
=
z
.
coerce
.
number
<
number
>
();
...
...
@@ -17,6 +18,7 @@ const StorageCosProtocolSchema = z.enum(['https:', 'http:']);
export
const
env
=
createEnv
({
server
:
{
FILE_TOKEN_KEY
:
z
.
string
().
min
(
6
,
'FILE_TOKEN_KEY must be at least 6 characters'
),
// ===== Agent sandbox =====
AGENT_SANDBOX_PROVIDER
:
z
.
enum
([
'sealosdevbox'
,
'opensandbox'
,
'e2b'
]).
optional
(),
AGENT_SANDBOX_E2B_API_KEY
:
z
.
string
().
optional
(),
...
...
@@ -124,7 +126,9 @@ export const env = createEnv({
SHOW_SKILL
:
BoolSchema
.
default
(
false
),
// Agent engine selection: 'default' uses the built-in Plan+Step engine, 'pi' uses pi-agent-core
AGENT_ENGINE
:
z
.
enum
([
'default'
,
'pi'
]).
default
(
'default'
)
AGENT_ENGINE
:
z
.
enum
([
'default'
,
'pi'
]).
default
(
'default'
),
SKIP_FILE_TYPE_CHECK
:
BoolSchema
.
default
(
false
)
},
emptyStringAsUndefined
:
true
,
runtimeEnv
:
process
.
env
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment