V4.14.5.1 dev (#6290)

* chore: cherry pick some commits from v4.14.6-dev (#6287)

* fix: custom domain limitation (#6265)

* fix: system secret (#6259)

* fix: system secret

* chore: update docs

* chore: docs

* fix password variable & datetime picker (#6276)

* fix password variable & datetime picker

* doc

* chore: cherry pick some commits from v4.14.6-dev (#6287)

* fix: custom domain limitation (#6265)

* fix: system secret (#6259)

* fix: system secret

* chore: update docs

* chore: docs

* doc

* chore: docs

---------

Co-authored-by: Finley Ge <32237950+FinleyGe@users.noreply.github.com>
Co-authored-by: Finley Ge <finleyge@fastgpt.io>

* perf: extname computed (#6285)

* perf: extname computed

* chore: handle hash or query flags

---------

Co-authored-by: Finley Ge <finleyge@fastgpt.io>

* chore: docs (#6291)

---------

Co-authored-by: heheer <heheer@sealos.io>
Co-authored-by: Archer <545436317@qq.com>
This commit is contained in:
Finley Ge
2026-01-19 19:10:54 +08:00
committed by GitHub
parent b7a10bff2b
commit 8450a44d35
15 changed files with 464 additions and 64 deletions

View File

@@ -1,5 +1,6 @@
import crypto from 'crypto';
import { customAlphabet } from 'nanoid';
import path from 'path';
/* check string is a web link */
export function strIsLink(str?: string) {
@@ -193,13 +194,14 @@ export const sliceStrStartEnd = (str: string, start: number, end: number) => {
=> pdf
*/
export const parseFileExtensionFromUrl = (url = '') => {
// Remove query params
const urlWithoutQuery = url.split('?')[0];
// Get file name
const fileName = urlWithoutQuery.split('/').pop() || '';
// Get file extension
const extension = fileName.split('.').pop();
return (extension || '').toLowerCase();
// Remove query params and hash first
const urlWithoutQuery = url.split('?')[0].split('#')[0];
const extension = path.extname(urlWithoutQuery);
// path.extname returns '.ext' or ''
if (extension.startsWith('.')) {
return extension.slice(1).toLowerCase();
}
return '';
};
export const formatNumberWithUnit = (num: number, locale: string = 'zh-CN'): string => {