Skip to content

Commit

Permalink
Release 0.31.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmartel committed Feb 20, 2024
1 parent 8d72dbb commit 7a7609b
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 45 deletions.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [v0.31.4](https://github.com/ivmartel/dwv/releases/tag/v0.31.4) - 20/02/2024

### Fixed

- Relax Accept header test for canLoadUrl methods [#1613](https://github.com/ivmartel/dwv/issues/1613)

## [v0.31.3](https://github.com/ivmartel/dwv/releases/tag/v0.31.3) - 16/11/2023

### Added
Expand Down
91 changes: 52 additions & 39 deletions dist/dwv.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! dwv 0.31.3 2023-11-16 12:13:08 */
/*! dwv 0.31.4 2024-02-20 12:23:37 */
// Inspired from umdjs
// See https://github.com/umdjs/umd/blob/master/templates/returnExports.js
(function (root, factory) {
Expand Down Expand Up @@ -4759,7 +4759,7 @@ dwv.dicom = dwv.dicom || {};
* @returns {string} The version of the library.
*/
dwv.getVersion = function () {
return '0.31.3';
return '0.31.4';
};

/**
Expand Down Expand Up @@ -24130,16 +24130,18 @@ dwv.io.DicomDataLoader.prototype.canLoadFile = function (file) {
* @returns {boolean} True if the url can be loaded.
*/
dwv.io.DicomDataLoader.prototype.canLoadUrl = function (url, options) {
// if there are options.requestHeaders, just base check on them
// check options.requestHeaders for 'Accept'
if (typeof options !== 'undefined' &&
typeof options.requestHeaders !== 'undefined') {
// starts with 'application/dicom'
var isDicom = function (element) {
return element.name === 'Accept' &&
dwv.utils.startsWith(element.value, 'application/dicom') &&
element.value[18] !== '+';
var isNameAccept = function (element) {
return element.name === 'Accept';
};
return typeof options.requestHeaders.find(isDicom) !== 'undefined';
var acceptHeader = options.requestHeaders.find(isNameAccept);
if (typeof acceptHeader !== 'undefined') {
// starts with 'application/dicom' and no '+'
return dwv.utils.startsWith(acceptHeader.value, 'application/dicom') &&
acceptHeader.value[18] !== '+';
}
}

var urlObjext = dwv.utils.getUrlFromUri(url);
Expand Down Expand Up @@ -24752,16 +24754,18 @@ dwv.io.JSONTextLoader.prototype.canLoadFile = function (file) {
* @returns {boolean} True if the url can be loaded.
*/
dwv.io.JSONTextLoader.prototype.canLoadUrl = function (url, options) {
// if there are options.requestHeader, just base check on them
// check options.requestHeaders for 'Accept'
if (typeof options !== 'undefined' &&
typeof options.requestHeaders !== 'undefined') {
// starts with 'application/json' or 'application/dicom+json
var isJson = function (element) {
return element.name === 'Accept' &&
dwv.utils.startsWith(element.value, 'application/json') &&
dwv.utils.startsWith(element.value, 'application/dicom+json');
var isNameAccept = function (element) {
return element.name === 'Accept';
};
return typeof options.requestHeaders.find(isJson) !== 'undefined';
var acceptHeader = options.requestHeaders.find(isNameAccept);
if (typeof acceptHeader !== 'undefined') {
// starts with 'application/json' or 'application/dicom+json
return dwv.utils.startsWith(acceptHeader.value, 'application/json') ||
dwv.utils.startsWith(acceptHeader.value, 'application/dicom+json');
}
}

var urlObjext = dwv.utils.getUrlFromUri(url);
Expand Down Expand Up @@ -25266,14 +25270,17 @@ dwv.io.MultipartLoader.prototype.canLoadFile = function (_file) {
* @returns {boolean} True if the url can be loaded.
*/
dwv.io.MultipartLoader.prototype.canLoadUrl = function (url, options) {
// if there are options.requestHeaders, just base check on them
// check options.requestHeaders for 'Accept'
if (typeof options !== 'undefined' &&
typeof options.requestHeaders !== 'undefined') {
var isMultipart = function (element) {
return element.name === 'Accept' &&
dwv.utils.startsWith(element.value, 'multipart/related');
var isNameAccept = function (element) {
return element.name === 'Accept';
};
return typeof options.requestHeaders.find(isMultipart) !== 'undefined';
var acceptHeader = options.requestHeaders.find(isNameAccept);
if (typeof acceptHeader !== 'undefined') {
// starts with 'multipart/related'
return dwv.utils.startsWith(acceptHeader.value, 'multipart/related');
}
}

return false;
Expand Down Expand Up @@ -25500,15 +25507,17 @@ dwv.io.RawImageLoader.prototype.canLoadFile = function (file) {
* @returns {boolean} True if the url can be loaded.
*/
dwv.io.RawImageLoader.prototype.canLoadUrl = function (url, options) {
// if there are options.requestHeaders, just base check on them
// check options.requestHeaders for 'Accept'
if (typeof options !== 'undefined' &&
typeof options.requestHeaders !== 'undefined') {
// starts with 'image/'
var isImage = function (element) {
return element.name === 'Accept' &&
dwv.utils.startsWith(element.value, 'image/');
var isNameAccept = function (element) {
return element.name === 'Accept';
};
return typeof options.requestHeaders.find(isImage) !== 'undefined';
var acceptHeader = options.requestHeaders.find(isNameAccept);
if (typeof acceptHeader !== 'undefined') {
// starts with 'image/'
return dwv.utils.startsWith(acceptHeader.value, 'image/');
}
}

var urlObjext = dwv.utils.getUrlFromUri(url);
Expand Down Expand Up @@ -25729,15 +25738,17 @@ dwv.io.RawVideoLoader.prototype.canLoadFile = function (file) {
* @returns {boolean} True if the url can be loaded.
*/
dwv.io.RawVideoLoader.prototype.canLoadUrl = function (url, options) {
// if there are options.requestHeaders, just base check on them
// check options.requestHeaders for 'Accept'
if (typeof options !== 'undefined' &&
typeof options.requestHeaders !== 'undefined') {
// starts with 'video/'
var isVideo = function (element) {
return element.name === 'Accept' &&
dwv.utils.startsWith(element.value, 'video/');
var isNameAccept = function (element) {
return element.name === 'Accept';
};
return typeof options.requestHeaders.find(isVideo) !== 'undefined';
var acceptHeader = options.requestHeaders.find(isNameAccept);
if (typeof acceptHeader !== 'undefined') {
// starts with 'video/'
return dwv.utils.startsWith(acceptHeader.value, 'video/');
}
}

var urlObjext = dwv.utils.getUrlFromUri(url);
Expand Down Expand Up @@ -27062,15 +27073,17 @@ dwv.io.ZipLoader.prototype.canLoadFile = function (file) {
* @returns {boolean} True if the url can be loaded.
*/
dwv.io.ZipLoader.prototype.canLoadUrl = function (url, options) {
// if there are options.requestHeaders, just base check on them
// check options.requestHeaders for 'Accept'
if (typeof options !== 'undefined' &&
typeof options.requestHeaders !== 'undefined') {
// starts with 'application/zip'
var isZip = function (element) {
return element.name === 'Accept' &&
dwv.utils.startsWith(element.value, 'application/zip');
var isNameAccept = function (element) {
return element.name === 'Accept';
};
return typeof options.requestHeaders.find(isZip) !== 'undefined';
var acceptHeader = options.requestHeaders.find(isNameAccept);
if (typeof acceptHeader !== 'undefined') {
// starts with 'application/zip'
return dwv.utils.startsWith(acceptHeader.value, 'application/zip');
}
}

var urlObjext = dwv.utils.getUrlFromUri(url);
Expand Down
4 changes: 2 additions & 2 deletions dist/dwv.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dwv",
"version": "0.31.3",
"version": "0.31.4",
"description": "DICOM Web Viewer.",
"keywords": [
"DICOM",
Expand Down
4 changes: 2 additions & 2 deletions resources/doc/jsdoc.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"package": "package.json",
"theme_opts": {
"title": "DWV",
"footer": "<i>Documentation generated for dwv v0.31.3.</i>",
"footer": "<i>Documentation generated for dwv v0.31.4.</i>",
"sections": [
"Tutorials",
"Namespaces",
Expand All @@ -50,7 +50,7 @@
"codepen": {
"enable_for": ["examples"],
"options": {
"js_external": "https://github.com/ivmartel/dwv/releases/download/v0.31.3/dwv-0.31.3.min.js",
"js_external": "https://github.com/ivmartel/dwv/releases/download/v0.31.4/dwv-0.31.4.min.js",
"html": "<div id='dwv'><div id='layerGroup0'></div></div>"
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/dicom/dicomParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dwv.dicom = dwv.dicom || {};
* @returns {string} The version of the library.
*/
dwv.getVersion = function () {
return '0.31.3';
return '0.31.4';
};

/**
Expand Down

0 comments on commit 7a7609b

Please sign in to comment.