File tree Expand file tree Collapse file tree
host/file-management/move Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -410,11 +410,20 @@ func (b *BaseApi) CheckFile(c *gin.Context) {
410410 if err := helper .CheckBindAndValidate (& req , c ); err != nil {
411411 return
412412 }
413- if _ , err := os .Stat (req .Path ); err != nil {
414- helper .SuccessWithData (c , false )
413+ fileOp := files .NewFileOp ()
414+ if fileOp .Stat (req .Path ) {
415+ helper .SuccessWithData (c , true )
416+ return
417+ }
418+ if req .WithInit {
419+ if err := fileOp .CreateDir (req .Path , 0644 ); err != nil {
420+ helper .SuccessWithData (c , false )
421+ return
422+ }
423+ helper .SuccessWithData (c , true )
415424 return
416425 }
417- helper .SuccessWithData (c , true )
426+ helper .SuccessWithData (c , false )
418427}
419428
420429// @Tags File
Original file line number Diff line number Diff line change @@ -76,7 +76,8 @@ type FileRename struct {
7676}
7777
7878type FilePathCheck struct {
79- Path string `json:"path" validate:"required"`
79+ Path string `json:"path" validate:"required"`
80+ WithInit bool `json:"withInit"`
8081}
8182
8283type FilePathsCheck struct {
Original file line number Diff line number Diff line change @@ -49,8 +49,8 @@ export const SaveFileContent = (params: File.FileEdit) => {
4949 return http . post < File . File > ( 'files/save' , params ) ;
5050} ;
5151
52- export const CheckFile = ( path : string ) => {
53- return http . post < boolean > ( 'files/check' , { path : path } ) ;
52+ export const CheckFile = ( path : string , withInit : boolean ) => {
53+ return http . post < boolean > ( 'files/check' , { path : path , withInit : withInit } ) ;
5454} ;
5555
5656export const BatchCheckFiles = ( paths : string [ ] ) => {
Original file line number Diff line number Diff line change @@ -308,7 +308,7 @@ const onSubmit = async () => {
308308 MsgError (i18n .global .t (' commons.msg.fileNameErr' ));
309309 return ;
310310 }
311- const res = await CheckFile (baseDir .value + file .raw .name );
311+ const res = await CheckFile (baseDir .value + file .raw .name , false );
312312 if (res .data ) {
313313 MsgError (i18n .global .t (' commons.msg.fileExist' ));
314314 return ;
Original file line number Diff line number Diff line change @@ -1385,6 +1385,7 @@ const message = {
13851385 existFileHelper : 'The uploaded file contains a file with the same name, do you want to overwrite it?' ,
13861386 existFileSize : 'File size (new -> old)' ,
13871387 existFileDirHelper : 'The selected file/folder has a duplicate name. Please proceed with caution!' ,
1388+ noSuchFile : 'The file or directory was not found. Please check and try again.' ,
13881389 } ,
13891390 ssh : {
13901391 setting : 'Setting' ,
Original file line number Diff line number Diff line change @@ -1363,6 +1363,7 @@ const message = {
13631363 existFileHelper : 'アップロードしたファイルに同じ名前のファイルが含まれています。上書きしますか?' ,
13641364 existFileSize : 'ファイルサイズ(新しい -> 古い)' ,
13651365 existFileDirHelper : '選択したファイル/フォルダーには同じ名前のものが既に存在します。慎重に操作してください!' ,
1366+ noSuchFile : 'ファイルまたはディレクトリが見つかりませんでした。確認して再試行してください。' ,
13661367 } ,
13671368 ssh : {
13681369 setting : '設定' ,
Original file line number Diff line number Diff line change @@ -1349,6 +1349,7 @@ const message = {
13491349 existFileHelper : '업로드한 파일에 동일한 이름의 파일이 포함되어 있습니다. 덮어쓰시겠습니까?' ,
13501350 existFileSize : '파일 크기 (새로운 -> 오래된)' ,
13511351 existFileDirHelper : '선택한 파일/폴더에 동일한 이름이 이미 존재합니다. 신중하게 작업하세요!' ,
1352+ noSuchFile : '파일 또는 디렉터리를 찾을 수 없습니다. 확인 후 다시 시도하세요.' ,
13521353 } ,
13531354 ssh : {
13541355 setting : '설정' ,
Original file line number Diff line number Diff line change @@ -1406,6 +1406,7 @@ const message = {
14061406 existFileHelper : 'Fail yang dimuat naik mengandungi fail dengan nama yang sama. Adakah anda mahu menimpanya?' ,
14071407 existFileSize : 'Saiz fail (baru -> lama)' ,
14081408 existFileDirHelper : 'Fail/folder yang dipilih mempunyai nama yang sama. Sila berhati-hati!' ,
1409+ noSuchFile : 'Fail atau direktori tidak ditemui. Sila periksa dan cuba lagi.' ,
14091410 } ,
14101411 ssh : {
14111412 setting : 'tetapan' ,
Original file line number Diff line number Diff line change @@ -1393,6 +1393,7 @@ const message = {
13931393 existFileHelper : 'O arquivo enviado contém um arquivo com o mesmo nome. Deseja substituí-lo?' ,
13941394 existFileSize : 'Tamanho do arquivo (novo -> antigo)' ,
13951395 existFileDirHelper : 'O arquivo/pasta selecionado tem um nome duplicado. Por favor, prossiga com cautela!' ,
1396+ noSuchFile : 'O arquivo ou diretório não foi encontrado. Por favor, verifique e tente novamente.' ,
13961397 } ,
13971398 ssh : {
13981399 setting : 'configuração' ,
Original file line number Diff line number Diff line change @@ -1395,6 +1395,7 @@ const message = {
13951395 existFileHelper : 'Загруженный файл содержит файл с таким же именем. Заменить его?' ,
13961396 existFileSize : 'Размер файла (новый -> старый)' ,
13971397 existFileDirHelper : 'Выбранный файл/папка имеет дублирующееся имя. Пожалуйста, действуйте осторожно!' ,
1398+ noSuchFile : 'Файл или каталог не найдены. Пожалуйста, проверьте и повторите попытку.' ,
13981399 } ,
13991400 ssh : {
14001401 setting : 'настройка' ,
You can’t perform that action at this time.
0 commit comments