-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow slashes in filenames #925
Conversation
0811b5e
to
9d878d5
Compare
This is the behavior added to Stacks in sul-dlss/stacks#925
9d878d5
to
694f375
Compare
This is the behavior added to Stacks in sul-dlss/stacks#925
Connects to sul-dlss/dor-services-app#4256 This commit supports work to support hierarchy in filenames throughout SDR. Doing this to support analysis work. Depends on sul-dlss/stacks#925
Connects to sul-dlss/dor-services-app#4256 This commit supports work to support hierarchy in filenames throughout SDR. Doing this to support analysis work. Depends on sul-dlss/stacks#925
Connects to sul-dlss/dor-services-app#4256 This commit supports work to support hierarchy in filenames throughout SDR. Doing this to support analysis work. Depends on sul-dlss/stacks#925
Connects to sul-dlss/dor-services-app#4256 This commit supports work to support hierarchy in filenames throughout SDR. Doing this to support analysis work. Depends on sul-dlss/stacks#925
Connects to sul-dlss/dor-services-app#4256 This commit supports work to support hierarchy in filenames throughout SDR. Doing this to support analysis work. Depends on sul-dlss/stacks#925
Connects to sul-dlss/dor-services-app#4256 This commit supports work to support hierarchy in filenames throughout SDR. Doing this to support analysis work. Depends on sul-dlss/stacks#925
694f375
to
4c71589
Compare
config/routes.rb
Outdated
get '/file/app/:id/:file_name' => 'webauth#login_file' | ||
get '/file/auth/:id/:file_name' => 'webauth#login_file', as: :auth_file | ||
constraints id: druid_regex do | ||
if Settings.features.allow_slashes_in_filenames |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need this conditional? can we just set these routes as required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jcoyne I'd be fine with that. Initially, one of the Access devs (maybe Chris?) asked if the feature could be behind a feature flag. LMK how you'd like to proceed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cbeer why do you want a feature flag here? Can't we just revert if it doesn't work? Otherwise we need additional testing so that we hit both paths, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cbeer say something if you think this is required. Otherwise I think we should remove it to minimize complexity and avoid having to clean this up in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jcoyne Removed in a follow-up commit.
Connects to sul-dlss/dor-services-app#4256 This commit supports work to support hierarchy in filenames throughout SDR. Doing this to support analysis work. Depends on sul-dlss/stacks#925
This commit supports work to support hierarchy in filenames throughout SDR. Doing this to support analysis work.
4c71589
to
32fd9f5
Compare
Connects to sul-dlss/dor-services-app#4256 This commit supports work to support hierarchy in filenames throughout SDR. Doing this to support analysis work. Depends on sul-dlss/stacks#925
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to add some requests tests that hit the FilesController and show that it can deal with files that have slashes?
spec/requests/file_spec.rb
Outdated
describe 'GET file with slashes in filename' do | ||
let(:stacks_file) { StacksFile.new(id: 'xf680rd3068', file_name: 'path/to/xf680rd3068_1.jp2') } | ||
let(:world_rights) do | ||
<<-EOF | ||
<publicObject> | ||
<rightsMetadata> | ||
<access type="read"> | ||
<machine> | ||
<world/> | ||
</machine> | ||
</access> | ||
</rightsMetadata> | ||
</publicObject> | ||
EOF | ||
end | ||
|
||
before do | ||
allow(File).to receive(:world_readable?).and_return(nil) | ||
allow_any_instance_of(FileController).to receive(:send_file).with(stacks_file.path, disposition: :inline) | ||
allow(Purl).to receive(:public_xml).and_return(world_rights) | ||
end | ||
|
||
it 'succeeds' do | ||
get '/file/xf680rd3068/path/to/xf680rd3068_1.jp2' | ||
expect(response).to be_successful | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cribbed authZ code from spec/requests/file_auth_request_spec.rb
.
@jcoyne 💬
Added a request test. |
92ae1d1
to
f31d86b
Compare
spec/requests/file_spec.rb
Outdated
end | ||
|
||
before do | ||
allow(File).to receive(:world_readable?).and_return(nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we returning files that aren't readable? Is this stub necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jcoyne Good eye! It was copypasta from the file auth request spec. Removed it and all is well.
f31d86b
to
97b6c0e
Compare
Connects to sul-dlss/dor-services-app#4256
This commit supports work to support hierarchy in filenames throughout SDR. Doing this to support analysis work.