Skip to content

Commit

Permalink
show errors
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
  • Loading branch information
Julien Veyssier committed Oct 20, 2021
1 parent 93d7fa5 commit 83db5a1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
6 changes: 1 addition & 5 deletions lib/Service/ImageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@

class ImageService {

/**
* @var string|null
*/
private $userId;
/**
* @var ShareManager
*/
Expand Down Expand Up @@ -89,7 +85,7 @@ public function downloadImageLink(string $link, string $userId): array {
}
$savedFile->touch();
if (isset($res['Content-Type'])) {
if ($res['Content-Type'] === 'image/jpg') {
if (in_array($res['Content-Type'], ['image/jpg', 'image/jpeg'])) {
$fileName = $fileName . '.jpg';
} elseif ($res['Content-Type'] === 'image/png') {
$fileName = $fileName . '.png';
Expand Down
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@nextcloud/auth": "^1.3.0",
"@nextcloud/axios": "^1.7.0",
"@nextcloud/browser-storage": "^0.1.1",
"@nextcloud/dialogs": "^3.1.2",
"@nextcloud/event-bus": "^2.1.0",
"@nextcloud/initial-state": "^1.2.0",
"@nextcloud/l10n": "^1.4.1",
Expand Down
3 changes: 3 additions & 0 deletions src/components/MenuBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ import ClickOutside from 'vue-click-outside'
import { getCurrentUser } from '@nextcloud/auth'
import axios from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router'
import { showError } from '@nextcloud/dialogs'
export default {
name: 'MenuBar',
Expand Down Expand Up @@ -356,6 +357,7 @@ export default {
this.insertImage(targetFilePath, this.imageCommand)
}).catch((error) => {
console.error(error)
showError(error?.response?.data?.error)
}).then(() => {
this.imageCommand = null
this.uploadingImage = false
Expand All @@ -375,6 +377,7 @@ export default {
this.insertImage(response.data?.path, command)
}).catch((error) => {
console.error(error)
showError(error?.response?.data?.error)
}).then(() => {
this.uploadingImage = false
})
Expand Down

0 comments on commit 83db5a1

Please sign in to comment.