Skip to content

Commit

Permalink
update file
Browse files Browse the repository at this point in the history
  • Loading branch information
juancristobalgd1 authored May 24, 2024
1 parent 324996b commit 8ad5a4f
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/libraries/Http/URI.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,19 +308,14 @@ protected function getTotalSegments(): int
*/
public function createNewUrl(string $uri, array $query = []): string
{
// Get the scheme, authority, and fragment components from the current URL
$scheme = $this->getScheme();
$authority = $this->getAuthority();
$fragment = $this->getFragment();

// Ensure the URI starts with CLEAN_URI_PATH and remove trailing slashes
$uri = CLEAN_URI_PATH . trim($uri, '/');

// Get the query component by processing the provided query parameters
$query = $this->getQuery($query);

// Create the full URL using the static method createURIString
return static::createURIString($scheme, $authority, $uri, $query, $fragment);
return static::createURIString($scheme, $authority, trim($uri, '/'), $query, $fragment);
}

/**
Expand All @@ -334,7 +329,7 @@ public function getUrl(string $url = null): string
$fragment = $this->getFragment();

// Use the provided $url or default CLEAN_URI_PATH for the path component
$cleanedUri = $url ?? CLEAN_URI_PATH ?? '';
$cleanedUri = $url ?? '';

// Get the query component from the current URL
$query = $this->getQuery();
Expand Down

0 comments on commit 8ad5a4f

Please sign in to comment.