mirror of
https://codeberg.org/VnPower/PixivFE
synced 2024-12-06 19:16:23 +01:00
fix broken IsLastPathPart
This commit is contained in:
@@ -14,20 +14,20 @@
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<!-- Replicate the thumbnail-tt structure -->
|
||||
<p class="text-truncate mb-0">
|
||||
<span class="fw-bold text-body-secondary text-decoration-none">{{ .Title }}</span>
|
||||
<p class="text-truncate fw-bold text-body-secondary text-decoration-none mb-0">
|
||||
{{ .Title }}
|
||||
</p>
|
||||
<!-- Replicate the thumbnail-at structure -->
|
||||
<div class="d-flex align-items-center mt-1">
|
||||
<img src="/img/deleted.png" class="rounded-circle me-1" style="width: 24px; height: 24px" />
|
||||
<span class="text-muted">Deleted or Private</span>
|
||||
<span class="text-body-secondary text-truncate">Deleted or Private</span>
|
||||
</div>
|
||||
</div>
|
||||
{{- else if .ID }}
|
||||
{{ include "thumbnail-dt" . }}
|
||||
<div class="card-body p-0">
|
||||
{{ include "thumbnail-tt" . }}
|
||||
{{- if isFirstPathPart (CurrentPath, "/users") == false || isLastPathPart (CurrentPath, "/bookmarks") == true }}
|
||||
{{- if isFirstPathPart (CurrentPath, "/users") == false || (isFirstPathPart (CurrentPath, "/users") == true && isLastPathPart (CurrentPath, "/bookmarks") == true) }}
|
||||
{{ include "thumbnail-at" . }}
|
||||
{{- end }}
|
||||
</div>
|
||||
|
||||
@@ -323,6 +323,12 @@ func IsFirstPathPart(currentPath, pathToCheck string) bool {
|
||||
|
||||
// IsLastPathPart checks if the last part of the current path matches the given path
|
||||
func IsLastPathPart(currentPath, pathToCheck string) bool {
|
||||
// Parse the currentPath to remove query parameters
|
||||
u, err := url.Parse(currentPath)
|
||||
if err == nil {
|
||||
currentPath = u.Path
|
||||
}
|
||||
|
||||
// Trim any trailing slashes from both paths
|
||||
currentPath = strings.TrimRight(currentPath, "/")
|
||||
pathToCheck = strings.TrimRight(pathToCheck, "/")
|
||||
|
||||
Reference in New Issue
Block a user