Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
RDMS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
researchdata
RDMS
Commits
f751fda4
Commit
f751fda4
authored
1 year ago
by
Anusha Ranganathan
Browse files
Options
Downloads
Patches
Plain Diff
Fix parsing of id for riiif viewer
parent
0ba3b0f7
Branches
bug_fix/375-file-not-visible-in-viewer
Branches containing commit
No related tags found
2 merge requests
!294
Create downloads volume
,
!293
Bug fix/375 file not visible in viewer
Pipeline
#13656
failed
1 year ago
Stage: build
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hyrax/config/initializers/riiif.rb
+10
-3
10 additions, 3 deletions
hyrax/config/initializers/riiif.rb
with
10 additions
and
3 deletions
hyrax/config/initializers/riiif.rb
+
10
−
3
View file @
f751fda4
...
...
@@ -14,7 +14,13 @@ ActiveSupport::Reloader.to_prepare do
end
Riiif
::
Image
.
file_resolver
.
id_to_uri
=
lambda
do
|
id
|
fs_id
=
id
.
sub
(
/\A([^\/]*)\/.*/
,
'\1'
)
# id is of the pattern
# /images/<fileset_id>/files/<uuid>/fcr:versions/version1/full/200,/0/default.jpg or
# <fileset_id>/files/<uuid>/fcr:versions/version1/full/200,/0/default.jpg
fs_id
=
id
fs_id
=
fs_id
.
gsub
(
/^\//
,
''
)
if
fs_id
.
start_with?
(
'/'
)
fs_id
=
fs_id
.
gsub
(
/^images\//
,
''
)
if
fs_id
.
start_with?
(
'images/'
)
fs_id
=
fs_id
.
split
(
'/'
)[
0
]
if
fs_id
.
include?
(
'/'
)
s3_file_url
(
fs_id
)
end
...
...
@@ -26,10 +32,11 @@ ActiveSupport::Reloader.to_prepare do
Riiif
::
Engine
.
config
.
cache_duration
=
365
.
days
def
s3_file_url
(
fs_id
)
return
""
unless
fs_id
file_set
=
FileSet
.
find
(
fs_id
)
return
""
unless
file_set
.
present?
s3
=
S3StorageService
.
new
s3
.
init_client
file_set
=
FileSet
.
find
(
fs_id
)
bucket_name
=
s3
.
sanitise_name
(
file_set
.
parent_works
.
first
.
id
)
file_key
=
file_set
.
title
.
first
s3
.
presigned_url_for_download
(
bucket_name
,
file_key
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment