Skip to content

Commit a4dc0b9

Browse files
committed
use absolute task url when provided
1 parent f2acbdc commit a4dc0b9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

api/app/models/ScheduledTask.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@ public function getCommand() {
2525
);
2626
$schedule = preg_match('/[a-z]/', $this->schedule) ? $shortcuts[$this->schedule] : $this->schedule;
2727

28-
$protocol = (isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) ? 'https' : 'http');
29-
// $public_url = $protocol . '://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['SCRIPT_NAME'] . '/' . $this->task;
30-
$public_url = $protocol . '://' . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'] . '/' . $this->task;
28+
$public_url = $this->task;
29+
if (!preg_match('/https?:/', $this->task)) {
30+
$protocol = (isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) ? 'https' : 'http');
31+
// $public_url = $protocol . '://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['SCRIPT_NAME'] . '/' . $this->task;
32+
$public_url = $protocol . '://' . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'] . '/' . $this->task;
33+
}
3134

3235
// TODO: redirect output to application log file.
3336
// https://github.com/doubleleft/dl-api/issues/37

0 commit comments

Comments
 (0)