mirror of https://github.com/bilde2910/Hauk.git
Return 404 if link is invalid; fixes #131
This commit is contained in:
parent
7b7bbb0767
commit
7f21ffb761
|
@ -15,6 +15,7 @@ $share = Share::fromShareID($memcache, $_GET["id"]);
|
|||
|
||||
// If the link data key is not set, the session probably expired.
|
||||
if (!$share->exists()) {
|
||||
header("HTTP/1.1 404 Not Found");
|
||||
die($LANG['session_invalid']."\n");
|
||||
} else {
|
||||
header("Content-Type: text/json");
|
||||
|
@ -24,7 +25,10 @@ if (!$share->exists()) {
|
|||
switch ($share->getType()) {
|
||||
case SHARE_TYPE_ALONE:
|
||||
$session = $share->getHost();
|
||||
if (!$session->exists()) die($LANG['session_invalid']."\n");
|
||||
if (!$session->exists()) {
|
||||
header("HTTP/1.1 404 Not Found");
|
||||
die($LANG['session_invalid']."\n");
|
||||
}
|
||||
echo json_encode(array(
|
||||
"type" => $share->getType(),
|
||||
"expire" => $share->getExpirationTime(),
|
||||
|
|
|
@ -258,7 +258,7 @@ function getJSON(url, callback, invalid) {
|
|||
if (this.readyState == 4) {
|
||||
var offlineE = document.getElementById("offline");
|
||||
var notchE = document.getElementById("notch");
|
||||
if (this.status === 200) {
|
||||
if (this.status === 200 || this.status === 404) {
|
||||
// Request successful. Reset offline state and parse the JSON.
|
||||
knownOffline = false;
|
||||
if (offlineE !== null) {
|
||||
|
|
Loading…
Reference in New Issue