Skip to content

Commit

Permalink
Support for head requests
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelfolaron committed Aug 24, 2024
1 parent a83f645 commit d8afdd9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions app/Core/Controller/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Log\Logger;
use Illuminate\Support\Facades\Log;
use Leantime\Core\Events\Eventhelpers;
use Leantime\Core\Http\IncomingRequest;
use Leantime\Core\Language;
Expand Down Expand Up @@ -69,6 +71,12 @@ public function __construct(
*/
private function executeActions(string $method, object|array $params): void
{

//HEAD execution is equal to GET. Server can handle the content response cutting for us.
if(strtoupper($method) == "HEAD") {
$method = "GET";
}

$available_params = [
'controller' => $this,
'method' => $method,
Expand All @@ -87,6 +95,7 @@ private function executeActions(string $method, object|array $params): void
} elseif (method_exists($this, 'run')) {
$this->response = $this->run();
} else {
Log::error('Method not found: ' . $method);
throw new HttpResponseException(Frontcontroller::redirect(BASE_URL . "/errors/error501", 307));
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/Domain/Menu/Templates/projectSelector.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class="dropdown-toggle bigProjectSelector {{ $menuType == "project" ? "active" :
@if(isset($projectTypeAvatars[$currentProjectType]) && $projectTypeAvatars[$currentProjectType] != "avatar")
<span class="{{ $projectTypeAvatars[$currentProjectType] }}"></span>
@else
<img src="{{ BASE_URL }}/api/projects?projectAvatar={{ $currentProject['id'] ?? -1 }}&v={{ format($currentProject['modified'])->timestamp() }}"/>
<img src="{{ BASE_URL }}/api/projects?projectAvatar={{ $currentProject['id'] ?? -1 }}&v={{ format($currentProject['modified'] ?? '')->timestamp() }}"/>
@endif
</span>
{{ $currentProject['name'] ?? "" }}&nbsp;
Expand Down
1 change: 1 addition & 0 deletions app/Domain/Projects/Controllers/NewProject.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public function run()
);

if (isset($_POST['save']) === true) {

if (!isset($_POST['hourBudget']) || $_POST['hourBudget'] == '' || $_POST['hourBudget'] == null) {
$hourBudget = '0';
} else {
Expand Down

0 comments on commit d8afdd9

Please sign in to comment.