diff --git a/app/serializers/activity_serializer.rb b/app/serializers/activity_serializer.rb index 9892fd70d..a5f9fc02d 100644 --- a/app/serializers/activity_serializer.rb +++ b/app/serializers/activity_serializer.rb @@ -14,6 +14,8 @@ class ActivitySerializer end attribute "prov:wasAttributedTo" do |object| + return nil if object.username.blank? + url = Rails.env.production? ? "https://api.datacite.org" : "https://api.test.datacite.org" object.username.include?(".") ? url + "/clients/" + object.username : url + "/providers/" + object.username end diff --git a/db/schema.rb b/db/schema.rb index b0b06523a..bc2bdaf4c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -330,4 +330,4 @@ add_foreign_key "dataset", "datacentre", column: "datacentre", name: "FK5605B47847B5F5FF" add_foreign_key "media", "dataset", column: "dataset", name: "FK62F6FE44D3D6B1B" add_foreign_key "metadata", "dataset", column: "dataset", name: "FKE52D7B2F4D3D6B1B" -end +end \ No newline at end of file