fixed silly MB stuff
This commit is contained in:
parent
c6b523c291
commit
8bf3483ceb
@ -7,6 +7,7 @@ import { interval, Subscription } from 'rxjs';
|
||||
import { AppConfigKey, AppConfigService } from '../../app-config/app-config.service';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { UploadDownloadDialogService } from './upload-download-dialog.service';
|
||||
import { toNumber } from '../../../utils/functions';
|
||||
|
||||
export interface ActiveUpload {
|
||||
subscription: Subscription;
|
||||
@ -47,7 +48,7 @@ export class FileUploadService {
|
||||
|
||||
async uploadFiles(files: FileUploadModel[]): Promise<number> {
|
||||
const maxSizeMB = this._appConfigService.getConfig(AppConfigKey.MAX_FILE_SIZE_MB, 100);
|
||||
const maxSizeBytes = maxSizeMB * 1024 * 1024;
|
||||
const maxSizeBytes = toNumber(maxSizeMB) * 1024 * 1024;
|
||||
const projectFiles = this._appStateService.activeProject.files;
|
||||
let option: 'overwrite' | 'skip' | undefined;
|
||||
for (let idx = 0; idx < files.length; ++idx) {
|
||||
|
||||
@ -88,3 +88,11 @@ export function lastIndexOfEnd(string, search) {
|
||||
const io = string.lastIndexOf(search);
|
||||
return io === -1 ? -1 : io + search.length;
|
||||
}
|
||||
|
||||
export function toNumber(string) {
|
||||
try {
|
||||
return parseInt(`${string}`.replace(/\D/g, ''), 10);
|
||||
} catch (e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ echo '{
|
||||
"LICENSE_EMAIL":"'"$LICENSE_EMAIL"'",
|
||||
"APP_NAME":"'"$APP_NAME"'",
|
||||
"AUTO_READ_TIME":'"$AUTO_READ_TIME"',
|
||||
"MAX_FILE_SIZE_MB":'"$MAX_FILE_SIZE_MB"',
|
||||
"MAX_FILE_SIZE_MB":"'"$MAX_FILE_SIZE_MB"'",
|
||||
"API_URL":"'"$API_URL"'"
|
||||
}' > /usr/share/nginx/html/ui/assets/config/config.json
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user