summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclsr <clsr@clsr.net>2016-06-16 17:01:01 +0000
committerclsr <clsr@clsr.net>2016-06-16 17:01:01 +0000
commite247aa4e05dc404214c09e7e54fb7d491c4bbb1d (patch)
treefd5cd20db4ca628dcc670fb1c06ffed5ba66e70f
parent7414366686753e3ad6ae26039821f81336ebc408 (diff)
downloadgomf-web-pomf-e247aa4e05dc404214c09e7e54fb7d491c4bbb1d.tar.gz
gomf-web-pomf-e247aa4e05dc404214c09e7e54fb7d491c4bbb1d.zip
Fix upload error displayv0.2.0
-rw-r--r--.gitignore1
-rw-r--r--pages/index.html6
-rw-r--r--static/pomf.js19
3 files changed, 13 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index bdb1eb9..6dd3664 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
/gomf
/*.go
/*.txt
+/upload/
diff --git a/pages/index.html b/pages/index.html
index f7d9f51..0a0c2b1 100644
--- a/pages/index.html
+++ b/pages/index.html
@@ -25,6 +25,12 @@
<span class="file-name">{{ .Name }}</span>
<span class="file-url"><a href="{{ .Url }}" target="_blank">{{ .Url }}</a></span>
</li>{{ end }}
+
+ {{ if or .Files .Description }}<li class="file total" data-filename="">
+ <span class="file-name">{{ if .Description }}{{ .Description }}{{ else }}Done!{{ end }}</span>
+ <span class="file-url"></span>
+ </li>{{ end }}
+
</ul>{{ end }}
</div>
diff --git a/static/pomf.js b/static/pomf.js
index dfa047a..361ffec 100644
--- a/static/pomf.js
+++ b/static/pomf.js
@@ -74,22 +74,15 @@ document.addEventListener('DOMContentLoaded', function() {
row.appendChild(url);
var link = document.createElement('a');
+ var response = JSON.parse(xhr.responseText);
if (respStatus === 200) {
- var response = JSON.parse(xhr.responseText);
- if (response.success) {
- link.textContent = response.files[0].url.replace(/.*?:\/\//g, "");
- link.href = response.files[0].url;
- url.appendChild(link);
- } else {
- bar.innerHTML = 'Error: ' + response.reason;
- }
- } else if (respStatus === 413) {
- link.textContent = 'File Too big!';
- url.appendChild(link);
+ link.textContent = response.files[0].url.replace(/.*?:\/\//g, "");
+ link.href = response.files[0].url;
} else {
- link.textContent = 'Server error!';
- url.appendChild(link);
+ link.textContent = response.description || 'Server error!';
+ bar.innerHTML = 'Error: ' + response.description;
}
+ url.appendChild(link);
}
function uploadFile(file, row) {