Merge branch 'develop' into feature/inifinite-scroll

This commit is contained in:
Alexey Safronov 2022-08-29 12:21:19 +03:00 committed by GitHub
commit 3413367480
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 8 deletions

View File

@ -237,7 +237,7 @@ class SettingsStore {
getPortalSettings = async () => { getPortalSettings = async () => {
const origSettings = await this.getSettings(); const origSettings = await this.getSettings();
if (origSettings.plugins.enabled) { if (origSettings?.plugins?.enabled) {
initPluginStore(); initPluginStore();
this.enablePlugins = origSettings.plugins.enabled; this.enablePlugins = origSettings.plugins.enabled;

View File

@ -219,7 +219,14 @@ internal abstract class SharpBoxDaoBase : ThirdPartyProviderDao<SharpBoxProvider
protected string MakePath(object entryId) protected string MakePath(object entryId)
{ {
return $"/{Convert.ToString(entryId, CultureInfo.InvariantCulture).Trim('/')}"; var id = Convert.ToString(entryId, CultureInfo.InvariantCulture);
if (!string.IsNullOrEmpty(id))
{
id = Encoding.UTF8.GetString(WebEncoders.Base64UrlDecode(id)).Trim('/');
}
return $"/{id}";
} }
protected override string MakeId(string path = null) protected override string MakeId(string path = null)
@ -245,7 +252,7 @@ internal abstract class SharpBoxDaoBase : ThirdPartyProviderDao<SharpBoxProvider
{ {
path = entry.Id; path = entry.Id;
} }
var p = string.IsNullOrEmpty(path) || path == "/" ? "" : ("-" + path.Replace('/', '|')); var p = string.IsNullOrEmpty(path) || path == "/" ? "" : ("-" + WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(path)));
return $"{PathPrefix}{p}"; return $"{PathPrefix}{p}";
} }

View File

@ -189,7 +189,8 @@ global using Microsoft.AspNetCore.Builder;
global using Microsoft.AspNetCore.Http; global using Microsoft.AspNetCore.Http;
global using Microsoft.AspNetCore.Mvc; global using Microsoft.AspNetCore.Mvc;
global using Microsoft.AspNetCore.Mvc.Filters; global using Microsoft.AspNetCore.Mvc.Filters;
global using Microsoft.AspNetCore.Mvc.ModelBinding; global using Microsoft.AspNetCore.Mvc.ModelBinding;
global using Microsoft.AspNetCore.WebUtilities;
global using Microsoft.EntityFrameworkCore; global using Microsoft.EntityFrameworkCore;
global using Microsoft.EntityFrameworkCore.Infrastructure; global using Microsoft.EntityFrameworkCore.Infrastructure;
global using Microsoft.EntityFrameworkCore.Metadata; global using Microsoft.EntityFrameworkCore.Metadata;

View File

@ -955,6 +955,7 @@ public class EntryManager
var folders = entries.Where(r => r.FileEntryType == FileEntryType.Folder).Except(pinnedRooms).Except(rooms); var folders = entries.Where(r => r.FileEntryType == FileEntryType.Folder).Except(pinnedRooms).Except(rooms);
var files = entries.Where(r => r.FileEntryType == FileEntryType.File); var files = entries.Where(r => r.FileEntryType == FileEntryType.File);
pinnedRooms = pinnedRooms.OrderBy(r => r, comparer); pinnedRooms = pinnedRooms.OrderBy(r => r, comparer);
rooms = rooms.OrderBy(r => r, comparer);
folders = folders.OrderBy(r => r, comparer); folders = folders.OrderBy(r => r, comparer);
files = files.OrderBy(r => r, comparer); files = files.OrderBy(r => r, comparer);

View File

@ -111,7 +111,14 @@ public class FileShareLink
} }
var fileId = Parse<T>(doc); var fileId = Parse<T>(doc);
var file = await fileDao.GetFileAsync(fileId);
File<T> file = null;
if (!EqualityComparer<T>.Default.Equals(fileId, default(T)))
{
file = await fileDao.GetFileAsync(fileId);
}
if (file == null) if (file == null)
{ {
return (FileShare.Restrict, file); return (FileShare.Restrict, file);

View File

@ -235,17 +235,20 @@ public class FilesControllerHelper<T> : FilesHelperBase<T>
public async Task<FileDto<T>> UpdateFileAsync(T fileId, string title, int lastVersion) public async Task<FileDto<T>> UpdateFileAsync(T fileId, string title, int lastVersion)
{ {
File<T> file = null;
if (!string.IsNullOrEmpty(title)) if (!string.IsNullOrEmpty(title))
{ {
await _fileStorageService.FileRenameAsync(fileId, title); file = await _fileStorageService.FileRenameAsync(fileId, title);
} }
if (lastVersion > 0) if (lastVersion > 0)
{ {
await _fileStorageService.UpdateToVersionAsync(fileId, lastVersion); var result = await _fileStorageService.UpdateToVersionAsync(fileId, lastVersion);
file = result.Key;
} }
return await GetFileInfoAsync(fileId); return await GetFileInfoAsync(file.Id);
} }
public async Task<FileDto<T>> UpdateFileStreamAsync(Stream file, T fileId, string fileExtension, bool encrypted = false, bool forcesave = false) public async Task<FileDto<T>> UpdateFileStreamAsync(Stream file, T fileId, string fileExtension, bool encrypted = false, bool forcesave = false)