Merge branch 'hotfix/v0.0.4' of github.com:ONLYOFFICE/AppServer into hotfix/v0.0.4
This commit is contained in:
commit
866f3573b0
@ -16,10 +16,7 @@ import { utils, api, toastr } from "asc-web-common";
|
||||
import {
|
||||
getFileIcon,
|
||||
getFolderIcon,
|
||||
isSpreadsheet,
|
||||
isPresentation,
|
||||
isDocument,
|
||||
getSelection,
|
||||
getSortedFiles,
|
||||
} from "../../../store/files/selectors";
|
||||
import {
|
||||
setSecondaryProgressBarData,
|
||||
@ -52,38 +49,15 @@ const formatKeys = Object.freeze({
|
||||
class DownloadDialogComponent extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
const { sortedFiles } = this.props;
|
||||
|
||||
changeLanguage(i18n);
|
||||
|
||||
const documents = [];
|
||||
const spreadsheets = [];
|
||||
const presentations = [];
|
||||
const other = [];
|
||||
|
||||
for (let item of props.items) {
|
||||
item.checked = true;
|
||||
item.format = formatKeys.OriginalFormat;
|
||||
|
||||
if (item.fileExst) {
|
||||
if (isSpreadsheet(item.fileExst)) {
|
||||
spreadsheets.push(item);
|
||||
} else if (isPresentation(item.fileExst)) {
|
||||
presentations.push(item);
|
||||
} else if (item.fileExst !== ".pdf" && isDocument(item.fileExst)) {
|
||||
documents.push(item);
|
||||
} else {
|
||||
other.push(item);
|
||||
}
|
||||
} else {
|
||||
other.push(item);
|
||||
}
|
||||
}
|
||||
|
||||
this.state = {
|
||||
documents,
|
||||
spreadsheets,
|
||||
presentations,
|
||||
other,
|
||||
documents: sortedFiles.documents,
|
||||
spreadsheets: sortedFiles.spreadsheets,
|
||||
presentations: sortedFiles.presentations,
|
||||
other: sortedFiles.other,
|
||||
|
||||
documentsTitleFormat: formatKeys.OriginalFormat,
|
||||
spreadsheetsTitleFormat: formatKeys.OriginalFormat,
|
||||
@ -631,7 +605,7 @@ const DownloadDialog = (props) => (
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
items: getSelection(state),
|
||||
sortedFiles: getSortedFiles(state),
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -1239,3 +1239,39 @@ export const isSecondaryProgressFinished = createSelector(
|
||||
return data && data.percent === 100;
|
||||
}
|
||||
);
|
||||
|
||||
export const getSortedFiles = (state) => {
|
||||
const formatKeys = Object.freeze({
|
||||
OriginalFormat: 0,
|
||||
});
|
||||
|
||||
const items = getSelection(state);
|
||||
|
||||
let sortedFiles = {
|
||||
documents: [],
|
||||
spreadsheets: [],
|
||||
presentations: [],
|
||||
other: [],
|
||||
};
|
||||
|
||||
for (let item of items) {
|
||||
item.checked = true;
|
||||
item.format = formatKeys.OriginalFormat;
|
||||
|
||||
if (item.fileExst) {
|
||||
if (isSpreadsheet(item.fileExst)(state)) {
|
||||
sortedFiles.spreadsheets.push(item);
|
||||
} else if (isPresentation(item.fileExst)(state)) {
|
||||
sortedFiles.presentations.push(item);
|
||||
} else if (item.fileExst !== ".pdf" && canWebEdit(item.fileExst)(state)) {
|
||||
sortedFiles.documents.push(item);
|
||||
} else {
|
||||
sortedFiles.other.push(item);
|
||||
}
|
||||
} else {
|
||||
sortedFiles.other.push(item);
|
||||
}
|
||||
}
|
||||
|
||||
return sortedFiles;
|
||||
};
|
||||
|
@ -80,11 +80,10 @@ namespace ASC.Web.Files
|
||||
}
|
||||
|
||||
public async Task Invoke(HttpContext context)
|
||||
{
|
||||
using var scope = ServiceProvider.CreateScope();
|
||||
var fileHandlerService = scope.ServiceProvider.GetService<FileHandlerService>();
|
||||
await fileHandlerService.Invoke(context);
|
||||
await Next.Invoke(context);
|
||||
{
|
||||
using var scope = ServiceProvider.CreateScope();
|
||||
var fileHandlerService = scope.ServiceProvider.GetService<FileHandlerService>();
|
||||
await fileHandlerService.Invoke(context).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,31 +186,31 @@ namespace ASC.Web.Files
|
||||
{
|
||||
case "view":
|
||||
case "download":
|
||||
await DownloadFile(context);
|
||||
await DownloadFile(context).ConfigureAwait(false);
|
||||
break;
|
||||
case "bulk":
|
||||
await BulkDownloadFile(context);
|
||||
await BulkDownloadFile(context).ConfigureAwait(false);
|
||||
break;
|
||||
case "stream":
|
||||
await StreamFile(context);
|
||||
await StreamFile(context).ConfigureAwait(false);
|
||||
break;
|
||||
case "empty":
|
||||
await EmptyFile(context);
|
||||
await EmptyFile(context).ConfigureAwait(false);
|
||||
break;
|
||||
case "tmp":
|
||||
await TempFile(context);
|
||||
await TempFile(context).ConfigureAwait(false);
|
||||
break;
|
||||
case "create":
|
||||
await CreateFile(context);
|
||||
await CreateFile(context).ConfigureAwait(false);
|
||||
break;
|
||||
case "redirect":
|
||||
Redirect(context);
|
||||
break;
|
||||
case "diff":
|
||||
await DifferenceFile(context);
|
||||
await DifferenceFile(context).ConfigureAwait(false);
|
||||
break;
|
||||
case "track":
|
||||
await TrackFile(context);
|
||||
await TrackFile(context).ConfigureAwait(false);
|
||||
break;
|
||||
default:
|
||||
throw new HttpException((int)HttpStatusCode.BadRequest, FilesCommonResource.ErrorMassage_BadRequest);
|
||||
@ -696,7 +695,8 @@ namespace ASC.Web.Files
|
||||
|
||||
try
|
||||
{
|
||||
await context.Response.Body.FlushAsync();
|
||||
await context.Response.Body.FlushAsync();
|
||||
await context.Response.CompleteAsync();
|
||||
//context.Response.SuppressContent = true;
|
||||
//context.ApplicationInstance.CompleteRequest();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user