Skip to content

Commit

Permalink
Merge pull request #3129 from Clinical-Genomics/avoid_file_system_crash
Browse files Browse the repository at this point in the history
Attempt at fixing file system not mounted IGV crash
  • Loading branch information
dnil authored Feb 7, 2022
2 parents abb5c7c + 06752fd commit 38c0d6f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ About changelog [here](https://keepachangelog.com/en/1.0.0/)
- Fix code typos
- Disable codefactor raised by ESLint for javascript functions located on another file
- Loading spinner stuck after downloading a PDF gene panel report
- IGV browser crashing when file system with alignment files is not mounted

## [4.47]
### Added
Expand Down
5 changes: 4 additions & 1 deletion scout/server/blueprints/alignviewers/partial.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ def parse_byte_range(byte_range):
def send_file_partial(path):
range_header = request.headers.get("Range", None)
if not range_header:
return send_file(path)
try:
return send_file(path)
except IOError:
return abort(404, "File not found")

try:
byte_range = parse_byte_range(request.headers["Range"])
Expand Down
13 changes: 2 additions & 11 deletions scout/server/blueprints/alignviewers/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,7 @@
import os.path

import requests
from flask import (
Blueprint,
Response,
abort,
current_app,
flash,
render_template,
request,
send_file,
)
from flask import Blueprint, Response, abort, render_template, request, send_file

from . import controllers
from .partial import send_file_partial
Expand Down Expand Up @@ -67,7 +58,7 @@ def remote_cors(remote_url):
@alignviewers_bp.route("/remote/static", methods=["OPTIONS", "GET"])
def remote_static():
"""Stream *large* static files with special requirements."""
file_path = request.args.get("file")
file_path = request.args.get("file") or ""
range_header = request.headers.get("Range", None)
if not range_header and (file_path.endswith(".bam") or file_path.endswith(".cram")):
return abort(500)
Expand Down

0 comments on commit 38c0d6f

Please sign in to comment.