Merge branch 'develop' into dev
All checks were successful
Build & Deploy on Dev / build (push) Successful in 52s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 52s
This commit is contained in:
commit
f4a2993a32
1 changed files with 3 additions and 3 deletions
|
|
@ -180,14 +180,14 @@ export class DocumentController extends Controller {
|
||||||
|
|
||||||
let fileList = !body.replace
|
let fileList = !body.replace
|
||||||
? body.fileList.map(({ fileName, ...props }) => {
|
? body.fileList.map(({ fileName, ...props }) => {
|
||||||
|
if(fileName.length > 85){
|
||||||
|
throw new Error("ไม่สามารถอัปโหลดไฟล์ได้ เนื่องจากชื่อไฟล์มีความยาวเกินที่ระบบกำหนด กรุณาปรับชื่อไฟล์ให้สั้นลง");
|
||||||
|
}
|
||||||
const dotIndex = fileName.lastIndexOf(".");
|
const dotIndex = fileName.lastIndexOf(".");
|
||||||
let originalName =
|
let originalName =
|
||||||
dotIndex !== -1 && !fileName.startsWith(".") ? fileName.slice(0, dotIndex) : fileName;
|
dotIndex !== -1 && !fileName.startsWith(".") ? fileName.slice(0, dotIndex) : fileName;
|
||||||
const extension =
|
const extension =
|
||||||
dotIndex !== -1 && !fileName.startsWith(".") ? fileName.slice(dotIndex) : "";
|
dotIndex !== -1 && !fileName.startsWith(".") ? fileName.slice(dotIndex) : "";
|
||||||
if([...originalName].length > 95){
|
|
||||||
originalName = [...originalName].slice(0, 95).join('');
|
|
||||||
}
|
|
||||||
let i = 1;
|
let i = 1;
|
||||||
while (list.findIndex((v) => v.fileName === fileName) !== -1 || used.includes(fileName)) {
|
while (list.findIndex((v) => v.fileName === fileName) !== -1 || used.includes(fileName)) {
|
||||||
fileName = `${originalName} (${i++})`;
|
fileName = `${originalName} (${i++})`;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue