curationexperts / alexandria-legacy

Alexandria Digital Research Library - http://alexandria.ucsb.edu
Other
6 stars 1 forks source link

Download metadata link returns error #665

Closed mark-dce closed 8 years ago

mark-dce commented 8 years ago

STEPS TO REPRODUCE 1) Make sure you have at least one image in your repo 2) Go to the view page for that image and click on the "Download Metadata" link in the "Tools" box at the right of the screen. EXPECTED BEHAVIOR; The application should display the turtle view of the objects graph ACTUAL BEHAVIOR: The application gives a NoMethodError in CatalogController#show - full dump:

NoMethodError in CatalogController#show
undefined method `image_url' for #<Module:0x007ffb585dd7d8> Did you mean? agent_url

Extracted source (around line #30):
28
29
30
31
32

    routes = Rails.application.routes.url_helpers
    builder = ActionDispatch::Routing::PolymorphicRoutes::HelperMethodBuilder
    builder.polymorphic_method routes, model, nil, :url, id: id, host: Rails.application.config.host_name
  end
end

Rails.root: /Users/mark/Documents/workspace/_no_backup/RubymineProjects/alexandria-v2

Application Trace | Framework Trace | Full Trace
actionpack (4.2.5.2) lib/action_dispatch/routing/polymorphic_routes.rb:222:in `polymorphic_method'
config/initializers/hydra_config.rb:30:in `block (2 levels) in <top (required)>'
hydra-core (9.8.1) app/models/hydra/content_negotiation/fedora_uri_replacer.rb:19:in `replace_uri'
hydra-core (9.8.1) app/models/hydra/content_negotiation/fedora_uri_replacer.rb:39:in `block in replaced_subjects'
hydra-core (9.8.1) app/models/hydra/content_negotiation/fedora_uri_replacer.rb:37:in `map'
hydra-core (9.8.1) app/models/hydra/content_negotiation/fedora_uri_replacer.rb:37:in `replaced_subjects'
hydra-core (9.8.1) app/models/hydra/content_negotiation/fedora_uri_replacer.rb:23:in `replaced_objects'
hydra-core (9.8.1) app/models/hydra/content_negotiation/fedora_uri_replacer.rb:10:in `run'
hydra-core (9.8.1) app/models/hydra/content_negotiation/replacing_graph_finder.rb:6:in `graph'
hydra-core (9.8.1) app/models/hydra/content_negotiation/clean_graph_repository.rb:13:in `find'
hydra-core (9.8.1) app/models/concerns/hydra/content_negotiation.rb:24:in `clean_graph'
hydra-core (9.8.1) app/models/concerns/hydra/content_negotiation.rb:18:in `export_as_ttl'
blacklight (6.0.2) app/models/concerns/blacklight/document/export.rb:90:in `export_as'
blacklight (6.0.2) app/controllers/concerns/blacklight/catalog.rb:163:in `block (2 levels) in additional_export_formats'
actionpack (4.2.5.2) lib/action_controller/metal/mime_responds.rb:217:in `respond_to'
blacklight (6.0.2) app/controllers/concerns/blacklight/catalog.rb:47:in `show'
actionpack (4.2.5.2) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.2.5.2) lib/abstract_controller/base.rb:198:in `process_action'
actionpack (4.2.5.2) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.2.5.2) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:92:in `__run_callbacks__'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.5.2) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.2.5.2) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.2.5.2) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (4.2.5.2) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.5.2) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.5.2) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.5.2) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.2.5.2) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.2.5.2) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.2.5.2) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.5.2) lib/action_view/rendering.rb:30:in `process'
actionpack (4.2.5.2) lib/action_controller/metal.rb:196:in `dispatch'
actionpack (4.2.5.2) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.5.2) lib/action_controller/metal.rb:237:in `block in action'
actionpack (4.2.5.2) lib/action_dispatch/routing/route_set.rb:74:in `dispatch'
actionpack (4.2.5.2) lib/action_dispatch/routing/route_set.rb:43:in `serve'
actionpack (4.2.5.2) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.5.2) lib/action_dispatch/journey/router.rb:30:in `each'
actionpack (4.2.5.2) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.5.2) lib/action_dispatch/routing/route_set.rb:815:in `call'
warden (1.2.6) lib/warden/manager.rb:35:in `block in call'
warden (1.2.6) lib/warden/manager.rb:34:in `catch'
warden (1.2.6) lib/warden/manager.rb:34:in `call'
rack (1.6.4) lib/rack/etag.rb:24:in `call'
rack (1.6.4) lib/rack/conditionalget.rb:25:in `call'
rack (1.6.4) lib/rack/head.rb:13:in `call'
actionpack (4.2.5.2) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.5.2) lib/action_dispatch/middleware/flash.rb:260:in `call'
rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.2.5.2) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.2.5.2) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.2.5.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
active-fedora (9.9.0) lib/active_fedora/ldp_cache.rb:26:in `call'
activerecord (4.2.5.2) lib/active_record/migration.rb:377:in `call'
actionpack (4.2.5.2) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:88:in `__run_callbacks__'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.5.2) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.5.2) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.5.2) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
actionpack (4.2.5.2) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.2.5.2) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.5.2) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.5.2) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.5.2) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.5.2) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.5.2) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.5.2) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.5.2) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.5.2) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
actionpack (4.2.5.2) lib/action_dispatch/middleware/static.rb:116:in `call'
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
railties (4.2.5.2) lib/rails/engine.rb:518:in `call'
railties (4.2.5.2) lib/rails/application.rb:165:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
rack (1.6.4) lib/rack/content_length.rb:15:in `call'
rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
/Users/mark/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
/Users/mark/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
/Users/mark/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
Request

Parameters:

{"id"=>"fk4cz3gd2g",
 "format"=>"ttl"}
Toggle session dump
Toggle env dump
Response

Headers:

None
dunn commented 8 years ago

https://github.library.ucsb.edu/ADRL/alexandria/pull/16/files should fix this. (Let me know if you try applying the patch and it doesn't!)

val99erie commented 8 years ago

@dunn & @mark-dce - I was able to reproduce the problem on my laptop with the code from master. Alex's patch does fix it.

This is the file that worked: https://raw.githubusercontent.com/curationexperts/alexandria-v2/alex-ttl/config/initializers/hydra_config.rb

dunn commented 8 years ago

From my PR:

Previously we were trying to send etd_url and image_url as methods to Rails.application.routes.url_helpers, but those are aliases for solr_document_url, defined in CurationConcernsHelper which url_helpers doesn't know about.

Is that a correct diagnosis of the problem?

dunn commented 8 years ago

See https://help.library.ucsb.edu/browse/DIGREPO-491?focusedCommentId=67187&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-67187 however; the commit that introduced this bug was meant to remove the localhost:8080 strings from the .ttl, and with this patch there are some still remaining. I don't know if that's because of this patch or if Justin's original fix was incomplete.

val99erie commented 8 years ago

@dunn I'm not sure what the root problem is yet. I'll have to dig around a little more tomorrow. But I did notice that this change will cause this spec to fail: https://github.com/curationexperts/alexandria-v2/blob/master/spec/controllers/local_authorities_controller_spec.rb#L6-L9

Instead of http://test.host/authorities/topics/#{topic.id}, it has http://test.host/catalog/#{topic_id}, so it messes up the path within the TTL itself.

dunn commented 8 years ago

What should the first line of the .ttl look like for images and ETDs? Something like

<http://alexandria.ucsb.edu/catalog/fk4417762f> a <http://projecthydra.org/works/models#Work>,

?

dunn commented 8 years ago

Per @chrissyrissmeyer we should have catalog records using the lib/ark:/48907/f3pz56x4 form in their .ttl URLs.

dunn commented 8 years ago

New, hacky patch idea here https://github.library.ucsb.edu/ADRL/alexandria/pull/21

dunn commented 8 years ago

Didn't notice the related ticket until just now: #660

val99erie commented 8 years ago

It looks like #660 is a duplicate of this story. I'll close it, and we can work off this story.

val99erie commented 8 years ago

Pull request submitted to UCSB repo: https://github.library.ucsb.edu/ADRL/alexandria/pull/35

Just waiting for it to be merged. I'll close this story.