Skip to content

Commit

Permalink
fix a partial FITS file download (Rust file handling has changed)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvo203 committed Feb 8, 2019
1 parent f67058b commit ade9676
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fits_web_ql"
version = "4.1.3"
version = "4.1.4"
authors = ["jvo203 <[email protected]>"]
edition = "2018"

Expand Down
6 changes: 3 additions & 3 deletions htdocs/fitswebql/fitswebql.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function get_js_version() {
return "JS2019-02-08.2";
return "JS2019-02-09.0";
}

const wasm_supported = (() => {
Expand Down Expand Up @@ -9761,8 +9761,8 @@ function partial_fits_download(offsetx, offsety, width, height) {
url += "x1=" + Math.round(orig_x1) + "&y1=" + Math.round(orig_y2) + "&x2=" + Math.round(orig_x2) + "&y2=" + Math.round(orig_y1) + "&frame_start=" + data_band_lo + "&frame_end=" + data_band_hi + "&ref_freq=" + RESTFRQ;

//console.log(url) ;
window.location.assign(url);
//window.open(url, '_blank');
//window.location.assign(url);
window.open(url, '_blank');
}

function ok_download() {
Expand Down
14 changes: 13 additions & 1 deletion src/fits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1675,7 +1675,7 @@ impl FITS {
let line = match std::str::from_utf8(slice) {
Ok(x) => x,
Err(err) => {
println!("non-UTF8 characters found: {}", err);
println!("non-UTF8 characters found: {}, bytes: {:?}", err, slice);
return true;
}
};
Expand Down Expand Up @@ -5922,6 +5922,12 @@ impl FITS {
return None;
}

//reset the file
if let Err(err) = f.seek(SeekFrom::Start(0)) {
println!("CRITICAL ERROR seeking within the FITS file: {}", err);
return None;
}

let mut header_end: bool = false;

while !header_end {
Expand Down Expand Up @@ -6110,6 +6116,12 @@ impl FITS {
return None;
}

//reset the file
if let Err(err) = f.seek(SeekFrom::Start(0)) {
println!("CRITICAL ERROR seeking within the FITS file: {}", err);
return None;
}

let mut header_end: bool = false;

while !header_end {
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2252,8 +2252,8 @@ lazy_static! {
#[cfg(feature = "server")]
static LOG_DIRECTORY: &'static str = "LOGS";

static SERVER_STRING: &'static str = "FITSWebQL v4.1.3";
static VERSION_STRING: &'static str = "SV2019-02-08.0";
static SERVER_STRING: &'static str = "FITSWebQL v4.1.4";
static VERSION_STRING: &'static str = "SV2019-02-09.0";
static WASM_STRING: &'static str = "WASM2019-02-08.1";

#[cfg(not(feature = "server"))]
Expand Down

0 comments on commit ade9676

Please sign in to comment.