Skip to content
Snippets Groups Projects
Commit b98a6fe5 authored by lain's avatar lain
Browse files

Fix file uploads in Chrome.

parent e81b3ea2
No related branches found
No related tags found
No related merge requests found
......@@ -20,12 +20,23 @@ const uploadMedia = ({ store, formData }) => {
const credentials = store.state.users.currentUser.credentials
return apiService.uploadMedia({ credentials, formData }).then((xml) => {
return {
// Firefox and Chrome treat method differently...
let link = xml.getElementsByTagName('link')
if (link.length === 0) {
link = xml.getElementsByTagName('atom:link')
}
link = link[0]
const mediaData = {
id: xml.getElementsByTagName('media_id')[0].textContent,
url: xml.getElementsByTagName('media_url')[0].textContent,
image: xml.getElementsByTagName('atom:link')[0].getAttribute('href'),
mimetype: xml.getElementsByTagName('atom:link')[0].getAttribute('type')
image: link.getAttribute('href'),
mimetype: link.getAttribute('type')
}
return mediaData
})
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment