Merge branch 'develop' into feature/compare-files-in-editor

This commit is contained in:
Ilya Oleshko 2021-09-01 15:46:58 +03:00 committed by GitHub
commit bdc190de13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 18 deletions

View File

@ -38,7 +38,7 @@ server {
etag on;
large_client_header_buffers 4 16k;
client_max_body_size 4G;
set $X_REWRITER_URL $the_scheme://$the_host;
if ($http_x_rewriter_url != '') {

View File

@ -23,6 +23,7 @@ class SettingsStore {
favoritesSection = null;
recentSection = null;
hideConfirmConvertSave = null;
chunkUploadSize = 1024 * 1023; // 1024 * 1023; //~0.999mb
settingsIsLoaded = false;

View File

@ -18,8 +18,6 @@ import {
moveToFolder,
} from "@appserver/common/api/files";
const chunkSize = 1024 * 1023; //~0.999mb
class UploadDataStore {
formatsStore;
treeFoldersStore;
@ -513,7 +511,9 @@ class UploadDataStore {
const { uploaded } = res.data.data;
const uploadedSize = uploaded ? fileSize : index * chunkSize;
const uploadedSize = uploaded
? fileSize
: index * this.settingsStore.chunkUploadSize;
const newPercent = this.getNewPercent(uploadedSize, indexOfFile);
@ -626,8 +626,10 @@ class UploadDataStore {
return Promise.resolve();
}
const { chunkUploadSize } = this.settingsStore;
const { file, toFolderId /*, action*/ } = item;
const chunks = Math.ceil(file.size / chunkSize, chunkSize);
const chunks = Math.ceil(file.size / chunkUploadSize, chunkUploadSize);
const fileName = file.name;
const fileSize = file.size;
const relativePath = file.path
@ -651,9 +653,9 @@ class UploadDataStore {
let chunk = 0;
while (chunk < chunks) {
const offset = chunk * chunkSize;
const offset = chunk * chunkUploadSize;
const formData = new FormData();
formData.append("file", file.slice(offset, offset + chunkSize));
formData.append("file", file.slice(offset, offset + chunkUploadSize));
requestsDataArray.push(formData);
chunk++;
}

View File

@ -322,8 +322,8 @@ namespace ASC.Files.Core.Data
if (folder.FolderType == FolderType.DEFAULT || folder.FolderType == FolderType.BUNCH)
{
FactoryIndexer.IndexAsync(toUpdate);
}
FactoryIndexer.IndexAsync(toUpdate);
}
}
else
{
@ -345,7 +345,7 @@ namespace ASC.Files.Core.Data
FilesDbContext.SaveChanges();
if (folder.FolderType == FolderType.DEFAULT || folder.FolderType == FolderType.BUNCH)
{
FactoryIndexer.IndexAsync(newFolder);
FactoryIndexer.IndexAsync(newFolder);
}
folder.ID = newFolder.Id;
@ -703,10 +703,7 @@ namespace ASC.Files.Core.Data
private int GetFoldersCount(int parentId)
{
var count = FilesDbContext.Tree
.AsNoTracking()
.Where(r => r.ParentId == parentId)
.Where(r => r.Level > 0)
.Count();
.Count(r => r.ParentId == parentId && r.Level > 0);
return count;
}
@ -714,9 +711,8 @@ namespace ASC.Files.Core.Data
private int GetFilesCount(int folderId)
{
var count = Query(FilesDbContext.Files)
.AsNoTracking()
.Distinct()
.Count(r => FilesDbContext.Tree.Where(r => r.ParentId == folderId).Select(r => r.FolderId).Contains(r.FolderId));
.Count(r => FilesDbContext.Tree.Any(t => t.ParentId == folderId && t.FolderId == r.FolderId));
return count;
}
@ -764,9 +760,9 @@ namespace ASC.Files.Core.Data
private void RecalculateFoldersCount(int id)
{
var toUpdate = Query(FilesDbContext.Folders)
.Join(FilesDbContext.Tree, r=> r.Id, r=> r.ParentId,(file, tree) => new { file, tree })
.Join(FilesDbContext.Tree, r => r.Id, r => r.ParentId, (file, tree) => new { file, tree })
.Where(r => r.tree.FolderId == id)
.Select(r=> r.file)
.Select(r => r.file)
.ToList();
foreach (var f in toUpdate)