Skip to content

Commit

Permalink
Merge branch 'hotfix/v1.0.1' of github.com:ONLYOFFICE/AppServer into …
Browse files Browse the repository at this point in the history
…hotfix/v1.0.1
  • Loading branch information
ilyaoleshko committed Nov 9, 2021
2 parents 677f7d7 + 75828a3 commit 6de5f81
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const SimpleFilesRow = (props) => {
);

return (
<StyledWrapper ref={props.selectableRef}>
<StyledWrapper>
<DragAndDrop
data-title={item.title}
value={value}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const checkedStyle = css`
const StyledTile = styled.div`
cursor: ${(props) => (!props.isRecycleBin ? "pointer" : "default")};
min-height: 57px;
box-sizing: border-box;
width: 100%;
border: 1px solid #d0d5da;
border-radius: 3px;
Expand Down Expand Up @@ -226,7 +227,7 @@ const StyledFileTileBottom = styled.div`
${FlexBoxStyles}
padding: 9px 10px;
padding-right: 0;
min-height: 56px;
height: 56px;
box-sizing: border-box;
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,36 @@ import AutoSizer from "react-virtualized-auto-sizer";
import Heading from "@appserver/components/heading";
import ContextMenu from "@appserver/components/context-menu";
import CustomScrollbarsVirtualList from "@appserver/components/scrollbar";

import { tablet, desktop } from "@appserver/components/utils/device";

const foldersStyle = css`
grid-gap: 19px 14px;
const paddingCss = css`
@media ${desktop} {
margin-left: 1px;
padding-right: 3px;
}
@media ${tablet} {
margin-left: -1px;
padding-right: 1px;
}
`;

const foldersStyle = css`
grid-gap: 19px 16px;
${paddingCss}
@media ${tablet} {
grid-gap: 17px 12px;
margin-left: -1px;
}
`;

const filesStyle = css`
grid-gap: 14px 18px;
grid-gap: 14px 16px;
@media ${desktop} {
padding-right: 5px;
}
${paddingCss}
@media ${tablet} {
grid-gap: 12px 14px;
margin-left: -1px;
padding-right: 2px;
grid-gap: 12px;
}
`;

Expand All @@ -59,10 +61,6 @@ const StyledTileContainer = styled.div`
}
&.folder {
padding: 0;
.drag-and-drop {
margin: 0px;
}
}
}
Expand All @@ -74,16 +72,6 @@ const StyledTileContainer = styled.div`
&.files {
padding-top: 8px;
}
margin-left: -1px;
}
@media (min-width: 1024px) {
.tile-item-wrapper {
&.file {
margin-left: 1px;
}
}
}
@media ${tablet} {
Expand Down
4 changes: 3 additions & 1 deletion products/ASC.Files/Core/Core/Dao/Interfaces/IFileDao.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,9 @@ public interface IFileDao<T>

void SaveThumbnail(File<T> file, Stream thumbnail);

Stream GetThumbnail(File<T> file);
Stream GetThumbnail(File<T> file);

Task<Stream> GetThumbnailAsync(File<T> file);

IEnumerable<(File<int>, SmallShareRecord)> GetFeeds(int tenant, DateTime from, DateTime to);

Expand Down
10 changes: 10 additions & 0 deletions products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,16 @@ public Stream GetThumbnail(File<int> file)
return storage.GetReadStream(string.Empty, path);
}

public async Task<Stream> GetThumbnailAsync(File<int> file)
{
var thumnailName = ThumbnailTitle + "." + Global.ThumbnailExtension;
var path = GetUniqFilePath(file, thumnailName);
var storage = GlobalStore.GetStore();
var isExist = await storage.IsFileAsync(string.Empty, path);
if (!isExist) throw new FileNotFoundException();
return await storage.GetReadStreamAsync(string.Empty, path, 0);
}

#endregion

private Func<Selector<DbFile>, Selector<DbFile>> GetFuncForSearch(object parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ public Stream GetThumbnail(File<string> file)
return null;
}

public Task<Stream> GetThumbnailAsync(File<string> file)
{
return null;
}

public virtual Stream GetFileStream(File<string> file)
{
return null;
Expand Down
2 changes: 1 addition & 1 deletion products/ASC.Files/Core/HttpHandlers/FileHandler.ashx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ private async Task ThumbnailFile<T>(HttpContext context, T id)
context.Response.Headers.Add("Content-Disposition", ContentDispositionUtil.GetHeaderValue("." + Global.ThumbnailExtension));
context.Response.ContentType = MimeMapping.GetMimeMapping("." + Global.ThumbnailExtension);

using (var stream = fileDao.GetThumbnail(file))
using (var stream = await fileDao.GetThumbnailAsync(file))
{
context.Response.Headers.Add("Content-Length", stream.Length.ToString(CultureInfo.InvariantCulture));
await stream.CopyToAsync(context.Response.Body);
Expand Down

0 comments on commit 6de5f81

Please sign in to comment.