]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Use an atom:link to ApiMediaUpload response instead of mediahref
authorMikael Nordfeldth <mmn@hethane.se>
Sat, 10 Oct 2015 18:36:54 +0000 (20:36 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Sat, 10 Oct 2015 18:41:14 +0000 (20:41 +0200)
'cause why not?

actions/apimediaupload.php

index fedaef17482076e29bb75f5d3542724c87f087c4..3a06a75e85114a0a714c9d3f5d2aab2f1735bb2a 100644 (file)
@@ -91,10 +91,14 @@ class ApiMediaUploadAction extends ApiAuthAction
     function showResponse(MediaFile $upload)
     {
         $this->initDocument();
-        $this->elementStart('rsp', array('stat' => 'ok'));
+        $this->elementStart('rsp', array('stat' => 'ok', 'xmlns:atom'=>Activity::ATOM));
         $this->element('mediaid', null, $upload->fileRecord->id);
         $this->element('mediaurl', null, $upload->shortUrl());
-        $this->element('mediahref', null, $upload->fileRecord->getUrl());
+
+        $enclosure = $upload->fileRecord->getEnclosure();
+        $this->element('atom:link', array('rel'  => 'enclosure',
+                                          'href' => $enclosure->url,
+                                          'type' => $enclosure->mimetype));
         $this->elementEnd('rsp');
         $this->endDocument();
     }