hydra-core 6.4.0 → 6.4.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27d360e48d308028e629a192bff49030c4531963
|
4
|
+
data.tar.gz: 2792914261dbf079ce249d0ee442cb6dd2a5c1e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdd6ca02a1bf8203154ab9a8e43316dcb5adcfb85c92a82cc4b8b29a6acd4b4d4cccaf8cc99a43e42d2956ede4e4dbf45ca7a526dccc4ddbef9f419783c3b72e
|
7
|
+
data.tar.gz: 2dd1d1e4d4d03ada5a302047dfe1e37ee401ed986493fd5b0092b5351e9923907f2e5f83e0c4291b505d10b21065930c1dae97305215b9002c628de6278c1a3d
|
@@ -11,8 +11,12 @@ module Hydra
|
|
11
11
|
# Responds to http requests to show the datastream
|
12
12
|
def show
|
13
13
|
if can_download?
|
14
|
-
|
15
|
-
|
14
|
+
if datastream.new?
|
15
|
+
render_404
|
16
|
+
else
|
17
|
+
# we can now examine asset and determine if we should send_content, or some other action.
|
18
|
+
send_content (asset)
|
19
|
+
end
|
16
20
|
else
|
17
21
|
logger.info "Can not read #{params[asset_param_key]}"
|
18
22
|
raise Hydra::AccessDenied.new("You do not have sufficient access privileges to read this document, which has been marked private.", :read, params[asset_param_key])
|
@@ -21,6 +25,13 @@ module Hydra
|
|
21
25
|
|
22
26
|
protected
|
23
27
|
|
28
|
+
def render_404
|
29
|
+
respond_to do |format|
|
30
|
+
format.html { render :file => "#{Rails.root}/public/404", :layout => false, :status => :not_found }
|
31
|
+
format.any { head :not_found }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
24
35
|
# Override this method if asset PID is not passed in params[:id],
|
25
36
|
# for example, in a nested resource.
|
26
37
|
def asset_param_key
|
@@ -55,7 +66,7 @@ module Hydra
|
|
55
66
|
# Loads the datastream specified by the HTTP parameter `:datastream_id`.
|
56
67
|
# If this object does not have a datastream by that name, return the default datastream
|
57
68
|
# as returned by {#default_content_ds}
|
58
|
-
# @return [ActiveFedora::Datastream] the
|
69
|
+
# @return [ActiveFedora::Datastream] the datastream
|
59
70
|
def datastream_to_show
|
60
71
|
ds = asset.datastreams[params[:datastream_id]] if params.has_key?(:datastream_id)
|
61
72
|
ds = default_content_ds if ds.nil?
|
data/lib/hydra-head/version.rb
CHANGED
@@ -15,9 +15,12 @@ describe DownloadsController do
|
|
15
15
|
|
16
16
|
describe "with a file" do
|
17
17
|
before do
|
18
|
+
class ContentHolder < ActiveFedora::Base
|
19
|
+
include Hydra::AccessControls::Permissions
|
20
|
+
has_file_datastream 'thumbnail'
|
21
|
+
end
|
18
22
|
@user = User.new.tap {|u| u.email = 'email@example.com'; u.password = 'password'; u.save}
|
19
|
-
@obj =
|
20
|
-
@obj = ModsAsset.new
|
23
|
+
@obj = ContentHolder.new
|
21
24
|
@obj.label = "world.png"
|
22
25
|
@obj.add_file_datastream('fizz', :dsid=>'buzz', :mimeType => 'image/png')
|
23
26
|
@obj.add_file_datastream('foobarfoobarfoobar', :dsid=>'content', :mimeType => 'image/png')
|
@@ -27,6 +30,7 @@ describe DownloadsController do
|
|
27
30
|
end
|
28
31
|
after do
|
29
32
|
@obj.destroy
|
33
|
+
Object.send(:remove_const, :ContentHolder)
|
30
34
|
end
|
31
35
|
describe "when logged in as reader" do
|
32
36
|
before do
|
@@ -35,7 +39,7 @@ describe DownloadsController do
|
|
35
39
|
end
|
36
40
|
describe "show" do
|
37
41
|
it "should default to returning default download configured by object" do
|
38
|
-
|
42
|
+
ContentHolder.stub(:default_content_ds).and_return('buzz')
|
39
43
|
get "show", :id => @obj.pid
|
40
44
|
response.should be_success
|
41
45
|
response.headers['Content-Type'].should == "image/png"
|
@@ -50,12 +54,23 @@ describe DownloadsController do
|
|
50
54
|
response.headers["Content-Disposition"].should == "inline; filename=\"world.png\""
|
51
55
|
response.body.should == 'foobarfoobarfoobar'
|
52
56
|
end
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
57
|
+
|
58
|
+
context "when a specific datastream is requested" do
|
59
|
+
context "and it doesn't exist" do
|
60
|
+
it "should return :not_found when the datastream doesn't exist" do
|
61
|
+
get "show", :id => @obj.pid, :datastream_id => "thumbnail"
|
62
|
+
response.should be_not_found
|
63
|
+
end
|
64
|
+
end
|
65
|
+
context "and it exists" do
|
66
|
+
it "should return it" do
|
67
|
+
get "show", :id => @obj.pid, :datastream_id => "descMetadata"
|
68
|
+
response.should be_success
|
69
|
+
response.headers['Content-Type'].should == "text/plain"
|
70
|
+
response.headers["Content-Disposition"].should == "inline; filename=\"world.png\""
|
71
|
+
response.body.should == "It's a stream"
|
72
|
+
end
|
73
|
+
end
|
59
74
|
end
|
60
75
|
it "should support setting disposition to inline" do
|
61
76
|
get "show", :id => @obj.pid, :disposition => "inline"
|
@@ -83,6 +98,7 @@ describe DownloadsController do
|
|
83
98
|
stub_ds.stub(:mimeType).and_return('video/webm')
|
84
99
|
stub_ds.stub(:dsSize).and_return(16)
|
85
100
|
stub_ds.stub(:dsid).and_return('webm')
|
101
|
+
stub_ds.stub(:new?).and_return(false)
|
86
102
|
stub_ds.stub(:pid).and_return('changeme:test')
|
87
103
|
stub_file = double('stub object', datastreams: {'webm' => stub_ds}, pid:'changeme:test', label: "MyVideo.webm")
|
88
104
|
ActiveFedora::Base.should_receive(:load_instance_from_solr).with('changeme:test').and_return(stub_file)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.4.
|
4
|
+
version: 6.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Zumwalt, Bess Sadler, Julie Meloni, Naomi Dushay, Jessie Keck, John Scofield,
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-11-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -93,14 +93,14 @@ dependencies:
|
|
93
93
|
requirements:
|
94
94
|
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 6.4.
|
96
|
+
version: 6.4.1
|
97
97
|
type: :runtime
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - '='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 6.4.
|
103
|
+
version: 6.4.1
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
105
|
name: jettywrapper
|
106
106
|
requirement: !ruby/object:Gem::Requirement
|
@@ -280,7 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
280
280
|
version: '0'
|
281
281
|
requirements: []
|
282
282
|
rubyforge_project:
|
283
|
-
rubygems_version: 2.
|
283
|
+
rubygems_version: 2.0.3
|
284
284
|
signing_key:
|
285
285
|
specification_version: 4
|
286
286
|
summary: Hydra-Head Rails Engine (requires Rails3)
|