Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/cydrobolt/polr.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChaoyi Zha <summermontreal@gmail.com>2016-02-12 18:59:13 +0300
committerChaoyi Zha <summermontreal@gmail.com>2016-02-12 18:59:13 +0300
commit8f35b83e7615d4a45c58f4f11b4caf3703c463a3 (patch)
tree291e52cb936ee632855328c40f335f673230dadc /app/Http/Controllers/Api/ApiLinkController.php
parent76589f6aa76dd654bd94f9ea3023811da103b0d9 (diff)
Correctly handle missing arguments
Diffstat (limited to 'app/Http/Controllers/Api/ApiLinkController.php')
-rw-r--r--app/Http/Controllers/Api/ApiLinkController.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/app/Http/Controllers/Api/ApiLinkController.php b/app/Http/Controllers/Api/ApiLinkController.php
index 03ad8cb..da5b574 100644
--- a/app/Http/Controllers/Api/ApiLinkController.php
+++ b/app/Http/Controllers/Api/ApiLinkController.php
@@ -12,8 +12,12 @@ class ApiLinkController extends ApiController {
$user = self::getApiUserInfo($request);
/* */
- $long_url = $request->input('url');
- $is_secret = ($request->input('is_secret') == 'false' ? false : true);
+ $long_url = $request->input('url'); // * required
+ $is_secret = ($request->input('is_secret') == 'true' ? true : false);
+
+ if (!self::checkRequiredArgs([$long_url])) {
+ abort(400, "Missing required arguments.");
+ }
$link_ip = $request->ip();
$custom_ending = $request->input('custom_ending');
@@ -29,7 +33,12 @@ class ApiLinkController extends ApiController {
/* */
- $url_ending = $request->input('url_ending');
+ $url_ending = $request->input('url_ending'); // * required
+
+ if (!self::checkRequiredArgs([$url_ending])) {
+ abort(400, "Missing required arguments.");
+ }
+
// "secret" key required for lookups on secret URLs
$url_key = $request->input('url_key');