Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
2f763975
Commit
2f763975
authored
Jan 21, 2020
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bump timeout for rendering an image to 20secs
parent
901f7027
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
18 deletions
+19
-18
src/utils/html.js
src/utils/html.js
+19
-18
No files found.
src/utils/html.js
View file @
2f763975
...
...
@@ -52,23 +52,6 @@ function slideOutWrapup (el) {
el
.
style
.
height
=
""
;
}
function
isImage
(
url
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
err_msg
=
`Could not determine whether it's an image:
${
url
}
`
;
const
img
=
new
Image
();
const
timer
=
window
.
setTimeout
(()
=>
reject
(
new
Error
(
err_msg
)),
3000
);
img
.
onerror
=
img
.
onabort
=
function
()
{
clearTimeout
(
timer
);
reject
(
new
Error
(
err_msg
));
};
img
.
onload
=
function
()
{
clearTimeout
(
timer
);
resolve
(
img
);
};
img
.
src
=
url
;
});
}
function
getURI
(
url
)
{
try
{
return
(
url
instanceof
URI
)
?
url
:
(
new
URI
(
url
));
...
...
@@ -180,11 +163,29 @@ u.applyDragResistance = function (value, default_value) {
};
function
loadImage
(
url
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
err_msg
=
`Could not determine whether it's an image:
${
url
}
`
;
const
img
=
new
Image
();
const
timer
=
window
.
setTimeout
(()
=>
reject
(
new
Error
(
err_msg
)),
20000
);
img
.
onerror
=
img
.
onabort
=
function
()
{
clearTimeout
(
timer
);
reject
(
new
Error
(
err_msg
));
};
img
.
onload
=
function
()
{
clearTimeout
(
timer
);
resolve
(
img
);
};
img
.
src
=
url
;
});
}
async
function
renderImage
(
img_url
,
link_url
,
el
,
callback
)
{
if
(
u
.
isImageURL
(
img_url
))
{
let
img
;
try
{
img
=
await
is
Image
(
img_url
);
img
=
await
load
Image
(
img_url
);
}
catch
(
e
)
{
log
.
error
(
e
);
return
callback
();
...
...
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