Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
SemWeb
libview
Commits
13041f9d9c47
Commit
b7b7c793
authored
Oct 25, 2018
by
Laurent Wouters
Browse files
[fix] Automatic upgrade upgrade to HTTPS on failure
parent
1961cbe7623a
Changes
1
Hide whitespace changes
Inline
Side-by-side
libview/src/view-def.ts
View file @
13041f9d
...
...
@@ -299,6 +299,20 @@ export function getResourceContent(
let
xmlHttp
=
new
XMLHttpRequest
();
xmlHttp
.
onreadystatechange
=
function
()
{
if
(
xmlHttp
.
readyState
==
4
)
{
if
(
xmlHttp
.
status
==
0
&&
uri
.
startsWith
(
"
http://
"
))
{
// try https
getResourceContent
(
cache
,
{
location
:
ViewResourceLocation
.
remote
,
uri
:
"
https:
"
+
uri
.
substring
(
"
http:
"
.
length
)
}
as
ViewResourceRemote
)
.
then
((
result
:
string
)
=>
{
resolve
(
result
);
})
.
catch
((
reason
:
any
)
=>
{
reject
(
"
Failed to fetch:
"
+
reason
);
});
return
;
}
if
(
xmlHttp
.
status
<
200
||
xmlHttp
.
status
>=
300
)
{
reject
(
"
HTTP error:
"
+
xmlHttp
.
status
);
return
;
...
...
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