Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Martin Schorb
VolumeAlign
Commits
045edc17
Commit
045edc17
authored
Jan 17, 2022
by
Martin Schorb
Browse files
check directories for invalid characters
parent
f76187eb
Pipeline
#28714
passed with stage
in 31 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
dash/filetypes/N5_export.py
View file @
045edc17
...
...
@@ -25,6 +25,7 @@ import params
from
utils
import
pages
,
launch_jobs
from
utils
import
helper_functions
as
hf
from
utils.checks
import
is_bad_filename
from
callbacks
import
substack_sel
,
filebrowse
...
...
@@ -493,7 +494,10 @@ def n5export_execute_gobutton(click,outdir,stack,n_cpu,timelim,comp_sel,owner,pr
else
:
if
outdir
==
''
:
return
True
,
'No output directory selected!'
,
dash
.
no_update
,
outstore
elif
is_bad_filename
(
outdir
):
return
True
,
'Wrong characters in input directory path. Please fix!'
,
dash
.
no_update
,
outstore
if
not
os
.
access
(
outdir
,
os
.
W_OK
|
os
.
X_OK
):
return
True
,
'Output directory not writable!'
,
dash
.
no_update
,
outstore
...
...
dash/inputtypes/sbem_conv.py
View file @
045edc17
...
...
@@ -23,8 +23,10 @@ import importlib
from
app
import
app
import
params
from
utils
import
launch_jobs
,
pages
,
checks
from
utils
import
helper_functions
as
hf
from
utils.checks
import
is_bad_filename
from
callbacks
import
filebrowse
,
render_selector
...
...
@@ -172,7 +174,6 @@ def sbem_conv_gobutton(stack_sel, in_dir, click, proj_dd_sel, compute_sel, run_s
trigger
=
ctx
.
triggered
[
0
][
'prop_id'
].
split
(
'.'
)[
0
].
partition
(
label
)[
2
]
but_disabled
=
True
popup
=
''
pop_display
=
False
out
=
run_state
log_file
=
run_state
[
'logfile'
]
...
...
@@ -226,26 +227,26 @@ def sbem_conv_gobutton(stack_sel, in_dir, click, proj_dd_sel, compute_sel, run_s
if
any
([
in_dir
==
''
,
in_dir
==
None
]):
if
not
(
run_state
[
'status'
]
==
'running'
):
run_state
[
'status'
]
=
'wait'
# params.processes[parent.strip('_')] = []
popup
=
'No input directory chosen.'
elif
is_bad_filename
(
in_dir
):
run_state
[
'status'
]
=
'wait'
popup
=
'Wrong characters in input directory path. Please fix!'
elif
os
.
path
.
isdir
(
in_dir
):
if
any
([
stack_sel
==
'newstack'
,
proj_dd_sel
==
'newproj'
]):
if
not
(
run_state
[
'status'
]
==
'running'
):
run_state
[
'status'
]
=
'wait'
# params.processes[parent.strip('_')] = []
else
:
if
not
(
run_state
[
'status'
]
==
'running'
):
run_state
[
'status'
]
=
'input'
# params.processes[parent.strip('_')] = []
but_disabled
=
False
else
:
if
not
(
run_state
[
'status'
]
==
'running'
):
run_state
[
'status'
]
=
'wait'
# params.processes[parent.strip('_')] = []
popup
=
'Directory not accessible.'
# pop_display = True
...
...
dash/inputtypes/serialem_conv.py
View file @
045edc17
...
...
@@ -25,6 +25,7 @@ import params
from
utils
import
launch_jobs
,
pages
,
checks
from
utils
import
helper_functions
as
hf
from
utils.checks
import
is_bad_filename
from
callbacks
import
filebrowse
,
render_selector
...
...
@@ -145,7 +146,8 @@ page2.append(collapse_stdout)
# =============================================
@
app
.
callback
([
Output
(
label
+
'go'
,
'disabled'
),
@
app
.
callback
([
Output
(
label
+
'go'
,
'disabled'
),
Output
(
label
+
'directory-popup'
,
'children'
),
Output
({
'component'
:
'store_launch_status'
,
'module'
:
label
},
'data'
),
Output
({
'component'
:
'store_render_launch'
,
'module'
:
label
},
'data'
)
],
...
...
@@ -163,7 +165,6 @@ def serialem_conv_gobutton(stack_sel, in_dir, click, proj_dd_sel, compute_sel, r
trigger
=
ctx
.
triggered
[
0
][
'prop_id'
].
split
(
'.'
)[
0
].
partition
(
label
)[
2
]
but_disabled
=
True
popup
=
''
pop_display
=
False
out
=
run_state
log_file
=
run_state
[
'logfile'
]
...
...
@@ -217,6 +218,11 @@ def serialem_conv_gobutton(stack_sel, in_dir, click, proj_dd_sel, compute_sel, r
if
not
(
run_state
[
'status'
]
==
'running'
):
run_state
[
'status'
]
=
'wait'
popup
=
'No input file chosen.'
elif
is_bad_filename
(
in_dir
):
run_state
[
'status'
]
=
'wait'
popup
=
'Wrong characters in input directory path. Please fix!'
elif
os
.
path
.
isfile
(
in_dir
):
# print(in_dir)
...
...
@@ -227,16 +233,14 @@ def serialem_conv_gobutton(stack_sel, in_dir, click, proj_dd_sel, compute_sel, r
else
:
if
not
(
run_state
[
'status'
]
==
'running'
):
run_state
[
'status'
]
=
'input'
but_disabled
=
False
else
:
if
not
(
run_state
[
'status'
]
==
'running'
):
run_state
[
'status'
]
=
'wait'
popup
=
'Input Data not accessible.'
pop_display
=
True
out
[
'logfile'
]
=
log_file
out
[
'status'
]
=
run_state
[
'status'
]
return
but_disabled
,
out
,
outstore
return
but_disabled
,
popup
,
out
,
outstore
\ No newline at end of file
dash/utils/checks.py
View file @
045edc17
...
...
@@ -22,3 +22,6 @@ def makeinput(component,prop='value'):
def
clean_render_name
(
instr
):
return
re
.
sub
(
'[^a-zA-Z0-9_]'
,
'_'
,
instr
)
def
is_bad_filename
(
instr
):
return
len
(
re
.
findall
(
'[^a-zA-Z0-9_./-]'
,
instr
))
>
0
\ No newline at end of file
Martin Schorb
@schorb
·
Jan 17, 2022
Author
Owner
fixes
#8 (closed)
fixes #8
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment