-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
guestbook: fix for when referer contains path
Signed-off-by: x-t <xdasht@pm.me>
- Loading branch information
Showing
3 changed files
with
37 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// x-t.github.io (c) 2023 | ||
// This work is licensed under the Creative Commons | ||
// Attribution-NonCommercial-ShareAlike 4.0 International | ||
// License. To view a copy of this license, visit | ||
// http://creativecommons.org/licenses/by-nc-sa/4.0/ or | ||
// send a letter to Creative Commons, PO Box 1866, | ||
// Mountain View, CA 94042, USA. | ||
|
||
package providers | ||
|
||
import ( | ||
"net/url" | ||
"fmt" | ||
) | ||
|
||
func RemovePathSegments(uri string) (string, error) { | ||
u, err := url.Parse(uri) | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
baseURI := fmt.Sprintf("%s://%s", u.Scheme, u.Host) | ||
|
||
return baseURI, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters