]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apistatusesupdate.php
shortenLinks with a capital L
[quix0rs-gnu-social.git] / actions / apistatusesupdate.php
index b9c229ed4ecddf5ca8fd767d4c2a73ddf0250de5..590ba1f06e41d73e733d3ac3ec2e4b43c758b957 100644 (file)
@@ -211,7 +211,7 @@ class ApiStatusesUpdateAction extends ApiAuthAction
             $this->clientError(_('No such user.'), 404);
         }
 
-        /* Do not call shortenlinks until the whole notice has been build */
+        /* Do not call shortenLinks until the whole notice has been build */
 
         // Check for commands
 
@@ -245,24 +245,19 @@ class ApiStatusesUpdateAction extends ApiAuthAction
             }
 
             $upload = null;
-
             try {
                 $upload = MediaFile::fromUpload('media', $this->scoped);
-            } catch (Exception $e) {
-                $this->clientError($e->getMessage(), $e->getCode());
-            }
-
-            if (isset($upload)) {
                 $this->status .= ' ' . $upload->shortUrl();
-
-                /* Do not call shortenlinks until the whole notice has been build */
+                /* Do not call shortenLinks until the whole notice has been build */
+            } catch (NoUploadedMediaException $e) {
+                // There was no uploaded media for us today.
             }
 
             /* Do call shortenlinks here & check notice length since notice is about to be saved & sent */
-            $status_shortened = $this->auth_user->shortenlinks($this->status);
+            $status_shortened = $this->auth_user->shortenLinks($this->status);
 
             if (Notice::contentTooLong($status_shortened)) {
-                if (isset($upload)) {
+                if ($upload instanceof MediaFile) {
                     $upload->delete();
                 }
                 // TRANS: Client error displayed exceeding the maximum notice length.