Skip to content

Commit

Permalink
for idaholab#361, some tweaks to the nginx conf to make sure query pa…
Browse files Browse the repository at this point in the history
…rameters get passed in
  • Loading branch information
mmguero committed Nov 12, 2024
1 parent 28b6d65 commit 429a45e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
3 changes: 2 additions & 1 deletion nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ http {
# extracted file download
location ~* ^/extracted-files\b(.*) {
include /etc/nginx/nginx_auth_rt.conf;
proxy_pass http://extracted-file-http-server$1;
proxy_pass http://extracted-file-http-server$1$is_args$args;
proxy_redirect off;
proxy_set_header Host file-monitor.malcolm.local;
}
Expand All @@ -204,6 +204,7 @@ http {
include /etc/nginx/nginx_auth_rt.conf;
include /etc/nginx/nginx_system_resolver.conf;
set $upstream $1:8006;
# TODO: check, do i need is_args/args here?
rewrite ^/hh-extracted-files/([a-zA-Z0-9-\.]+)(.*)$ $2 break;
proxy_pass https://$upstream;
proxy_ssl_verify off;
Expand Down
22 changes: 5 additions & 17 deletions shared/bin/extracted_files_http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@
malcolm_forward_header = 'X-Malcolm-Forward'


###################################################################################################
# a function for performing "natural" (case insensitive) sort
def natural_sort_key(s, _nsre=re.compile('([0-9]+)')):
return [int(text) if text.isdigit() else text.lower() for text in _nsre.split(s)]


###################################################################################################
# return the names and flags for Zipping a list of files
def LocalFilesForZip(names):
Expand Down Expand Up @@ -146,15 +140,15 @@ def do_GET(self):

for dirpath, dirnames, filenames in os.walk(fullpath):
# list directories first
for dirname in sorted(dirnames, key=natural_sort_key):
for dirname in sorted(dirnames, key=str.casefold):
try:
child = os.path.join(dirpath, dirname)
if args.links or (not os.path.islink(child)):
items.append(('dir', dirname, child))
except Exception as e:
eprint(f'Error with directory "{dirname}"": {e}')
# list files
for filename in sorted(filenames, key=natural_sort_key):
for filename in sorted(filenames, key=str.casefold):
try:
child = os.path.join(dirpath, filename)
if args.links or (not os.path.islink(child)):
Expand Down Expand Up @@ -236,9 +230,7 @@ def do_GET(self):
timestamp = datetime.strptime(timestampStr, '%Y%m%d%H%M%S')
timestampStr = timestamp.isoformat()
timestampStartFilterStr = (
(timestamp - timedelta(days=1))
.isoformat()
.split('.')[0]
(timestamp - timedelta(days=1)).isoformat().split('.')[0]
)
except Exception as te:
if timestampStr:
Expand Down Expand Up @@ -296,7 +288,7 @@ def do_GET(self):
),
td(sizeof_fmt(os.path.getsize(child)), style="text-align: right"),
)

# show special malcolm columns if requested
if showMalcolmCols:
if fmatch is not None:
Expand Down Expand Up @@ -348,11 +340,7 @@ def do_GET(self):
li(span('Previous', cls='page-link disabled'), cls='page-item')

# add a space between text
li(
' ',
cls='page-item spacer',
style='width: 10px;'
)
li(' ', cls='page-item spacer', style='width: 10px;')

# next page link
if page < totalPages:
Expand Down

0 comments on commit 429a45e

Please sign in to comment.