about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-10-07 18:55:48 +0200
committerGitHub <noreply@github.com>2017-10-07 18:55:48 +0200
commit967e70663fc694836e3b99595bea74485557cbd1 (patch)
treee2ba61c1ef17c48de39e7b15803e2f9b5855a454 /app
parentb7e65a004f4b02a732282c34c6c08ff3ae28ffc0 (diff)
In REST API, when URL can be missing, cast it to nil (#5259)
Diffstat (limited to 'app')
-rw-r--r--app/serializers/rest/application_serializer.rb4
-rw-r--r--app/serializers/rest/media_attachment_serializer.rb4
2 files changed, 8 insertions, 0 deletions
diff --git a/app/serializers/rest/application_serializer.rb b/app/serializers/rest/application_serializer.rb
index a8945f66e..a9316cd4b 100644
--- a/app/serializers/rest/application_serializer.rb
+++ b/app/serializers/rest/application_serializer.rb
@@ -15,4 +15,8 @@ class REST::ApplicationSerializer < ActiveModel::Serializer
   def client_secret
     object.secret
   end
+
+  def website
+    object.website.presence
+  end
 end
diff --git a/app/serializers/rest/media_attachment_serializer.rb b/app/serializers/rest/media_attachment_serializer.rb
index e6e9c8e82..51011788b 100644
--- a/app/serializers/rest/media_attachment_serializer.rb
+++ b/app/serializers/rest/media_attachment_serializer.rb
@@ -19,6 +19,10 @@ class REST::MediaAttachmentSerializer < ActiveModel::Serializer
     end
   end
 
+  def remote_url
+    object.remote_url.presence
+  end
+
   def preview_url
     if object.needs_redownload?
       media_proxy_url(object.id, :small)