redir_info only has data if we ran discovery

This commit is contained in:
Mikael Nordfeldth 2015-12-08 11:42:09 +01:00
parent 4fecda58ff
commit 441e2c8d34

View File

@ -192,16 +192,18 @@ class File_redirection extends Managed_DataObject
if (!empty($r->file_id)) { if (!empty($r->file_id)) {
return $r; return $r;
} }
}
$redir->httpcode = $redir_info['code']; $redir->httpcode = $redir_info['code'];
$redir->redirections = intval($redir_info['redirects']); $redir->redirections = intval($redir_info['redirects']);
$redir->file = new File(); $redir->file = new File();
$redir->file->url = $redir_info ? $redir_info['url'] : $in_url; $redir->file->url = $redir_info ? $redir_info['url'] : $in_url;
$redir->file->mimetype = $redir_info['type']; $redir->file->mimetype = $redir_info['type'];
$redir->file->size = $redir_info['size']; $redir->file->size = $redir_info['size'];
$redir->file->date = $redir_info['time']; $redir->file->date = $redir_info['time'];
if($redir_info['protected']) $redir->file->protected = true; if ($redir_info['protected']) {
$redir->file->protected = true;
}
}
return $redir; return $redir;
} }