mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Whitespace is not trimmed from the end of query strings (#1263)
* fixed whitespace not trimmed query string * fixed whitespace trimming on backend * added query trim tests and fixed double space
This commit is contained in:
@@ -20,6 +20,10 @@ import (
|
||||
"github.com/stashapp/stash/pkg/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
spacedSceneTitle = "zzz yyy xxx"
|
||||
)
|
||||
|
||||
const (
|
||||
sceneIdxWithMovie = iota
|
||||
sceneIdxWithGallery
|
||||
@@ -33,6 +37,7 @@ const (
|
||||
sceneIdxWithMarker
|
||||
sceneIdxWithPerformerTag
|
||||
sceneIdxWithPerformerTwoTags
|
||||
sceneIdxWithSpacedName
|
||||
// new indexes above
|
||||
lastSceneIdx
|
||||
|
||||
@@ -452,6 +457,15 @@ func getSceneNullStringValue(index int, field string) sql.NullString {
|
||||
return getPrefixedNullStringValue("scene", index, field)
|
||||
}
|
||||
|
||||
func getSceneTitle(index int) string {
|
||||
switch index {
|
||||
case sceneIdxWithSpacedName:
|
||||
return spacedSceneTitle
|
||||
default:
|
||||
return getSceneStringValue(index, titleField)
|
||||
}
|
||||
}
|
||||
|
||||
func getRating(index int) sql.NullInt64 {
|
||||
rating := index % 6
|
||||
return sql.NullInt64{Int64: int64(rating), Valid: rating > 0}
|
||||
@@ -493,7 +507,7 @@ func createScenes(sqb models.SceneReaderWriter, n int) error {
|
||||
for i := 0; i < n; i++ {
|
||||
scene := models.Scene{
|
||||
Path: getSceneStringValue(i, pathField),
|
||||
Title: sql.NullString{String: getSceneStringValue(i, titleField), Valid: true},
|
||||
Title: sql.NullString{String: getSceneTitle(i), Valid: true},
|
||||
Checksum: sql.NullString{String: getSceneStringValue(i, checksumField), Valid: true},
|
||||
Details: sql.NullString{String: getSceneStringValue(i, "Details"), Valid: true},
|
||||
URL: getSceneNullStringValue(i, urlField),
|
||||
|
||||
Reference in New Issue
Block a user