Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
960af444
Commit
960af444
authored
Aug 30, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: fix linter
parent
20570fc7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
resource_service.go
server/router/api/v1/resource_service.go
+5
-5
No files found.
server/router/api/v1/resource_service.go
View file @
960af444
...
...
@@ -182,7 +182,7 @@ func (s *APIV1Service) GetResourceBinary(ctx context.Context, request *v1pb.GetR
}
if
request
.
Thumbnail
&&
util
.
HasPrefixes
(
resource
.
Type
,
SupportedThumbnailMimeTypes
...
)
{
thumbnailBlob
,
err
:=
s
.
getOrGenerateThumbnail
(
ctx
,
resource
)
thumbnailBlob
,
err
:=
s
.
getOrGenerateThumbnail
(
resource
)
if
err
!=
nil
{
// thumbnail failures are logged as warnings and not cosidered critical failures as
// a resource image can be used in its place.
...
...
@@ -195,7 +195,7 @@ func (s *APIV1Service) GetResourceBinary(ctx context.Context, request *v1pb.GetR
}
}
blob
,
err
:=
s
.
GetResourceBlob
(
ctx
,
resource
)
blob
,
err
:=
s
.
GetResourceBlob
(
resource
)
if
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
Internal
,
"failed to get resource blob: %v"
,
err
)
}
...
...
@@ -384,7 +384,7 @@ func SaveResourceBlob(ctx context.Context, s *store.Store, create *store.Resourc
return
nil
}
func
(
s
*
APIV1Service
)
GetResourceBlob
(
ctx
context
.
Context
,
resource
*
store
.
Resource
)
([]
byte
,
error
)
{
func
(
s
*
APIV1Service
)
GetResourceBlob
(
resource
*
store
.
Resource
)
([]
byte
,
error
)
{
blob
:=
resource
.
Blob
if
resource
.
StorageType
==
storepb
.
ResourceStorageType_LOCAL
{
resourcePath
:=
filepath
.
FromSlash
(
resource
.
Reference
)
...
...
@@ -409,7 +409,7 @@ func (s *APIV1Service) GetResourceBlob(ctx context.Context, resource *store.Reso
}
// getOrGenerateThumbnail returns the thumbnail image of the resource.
func
(
s
*
APIV1Service
)
getOrGenerateThumbnail
(
ctx
context
.
Context
,
resource
*
store
.
Resource
)
([]
byte
,
error
)
{
func
(
s
*
APIV1Service
)
getOrGenerateThumbnail
(
resource
*
store
.
Resource
)
([]
byte
,
error
)
{
thumbnailCacheFolder
:=
filepath
.
Join
(
s
.
Profile
.
Data
,
ThumbnailCacheFolder
)
if
err
:=
os
.
MkdirAll
(
thumbnailCacheFolder
,
os
.
ModePerm
);
err
!=
nil
{
return
nil
,
errors
.
Wrap
(
err
,
"failed to create thumbnail cache folder"
)
...
...
@@ -430,7 +430,7 @@ func (s *APIV1Service) getOrGenerateThumbnail(ctx context.Context, resource *sto
}()
// Otherwise, generate and save the thumbnail image.
blob
,
err
:=
s
.
GetResourceBlob
(
ctx
,
resource
)
blob
,
err
:=
s
.
GetResourceBlob
(
resource
)
if
err
!=
nil
{
return
nil
,
errors
.
Wrap
(
err
,
"failed to get resource blob"
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment