mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
Allow path separator in scene filename parser pattern (#327)
* Allow path in filename parser
* Fix helper text re escaping {} characters
This commit is contained in:
@@ -335,9 +335,15 @@ func (h *sceneHolder) postParse() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m parseMapper) parse(scene *models.Scene) *sceneHolder {
|
func (m parseMapper) parse(scene *models.Scene) *sceneHolder {
|
||||||
// perform matching on basename
|
|
||||||
// TODO - may want to handle full path at some point
|
// #302 - if the pattern includes a path separator, then include the entire
|
||||||
|
// scene path in the match. Otherwise, use the default behaviour of just
|
||||||
|
// the file's basename
|
||||||
|
// must be double \ because of the regex escaping
|
||||||
filename := filepath.Base(scene.Path)
|
filename := filepath.Base(scene.Path)
|
||||||
|
if strings.Contains(m.regexString, `\\`) || strings.Contains(m.regexString, "/") {
|
||||||
|
filename = scene.Path
|
||||||
|
}
|
||||||
|
|
||||||
result := m.regex.FindStringSubmatch(filename)
|
result := m.regex.FindStringSubmatch(filename)
|
||||||
|
|
||||||
|
|||||||
@@ -694,7 +694,7 @@ export const SceneFilenameParser: FunctionComponent<IProps> = (props: IProps) =>
|
|||||||
<FormGroup
|
<FormGroup
|
||||||
label="Filename pattern:"
|
label="Filename pattern:"
|
||||||
inline={true}
|
inline={true}
|
||||||
helperText="Use '\\' to escape literal {} characters"
|
helperText="Use '\' to escape literal {} characters"
|
||||||
>
|
>
|
||||||
<InputGroup
|
<InputGroup
|
||||||
onChange={(newValue: any) => setPattern(newValue.target.value)}
|
onChange={(newValue: any) => setPattern(newValue.target.value)}
|
||||||
|
|||||||
Reference in New Issue
Block a user