Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Linnea Samila
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 7ff99530
authored
Jun 05, 2015
by
Juho Juopperi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XXX: fallback unknown filetypes to jpeg
1 parent
436301a9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletions
code/moya-web/src/main/java/fi/codecrew/moya/rest/v2/UserRestViewV2.java
code/moya-web/src/main/java/fi/codecrew/moya/rest/v2/UserRestViewV2.java
View file @
7ff9953
...
@@ -172,7 +172,20 @@ public class UserRestViewV2 {
...
@@ -172,7 +172,20 @@ public class UserRestViewV2 {
User
user
=
userBean
.
getUser
(
userId
);
User
user
=
userBean
.
getUser
(
userId
);
UserImage
image
=
user
.
getCurrentImage
();
UserImage
image
=
user
.
getCurrentImage
();
//logger.info("Mimetype: " + body.getMediaType());
//logger.info("Mimetype: " + body.getMediaType());
return
Response
.
ok
(
image
.
getImageData
(),
image
.
getMimeType
()).
build
();
// XXX: Vectorama2015 - assume image/jpeg if mime type not known
String
mimeType
=
image
.
getMimeType
();
if
(
mimeType
!=
null
)
{
if
(!
mimeType
.
equals
(
"image/png"
)
&&
!
mimeType
.
equals
(
"image/gif"
))
{
// fallback
mimeType
=
"image/jpeg"
;
}
}
else
{
// fallback if null
mimeType
=
"image/jpeg"
;
}
return
Response
.
ok
(
image
.
getImageData
(),
mimeType
).
build
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"Getting image failed"
,
e
);
logger
.
error
(
"Getting image failed"
,
e
);
return
Response
.
serverError
().
entity
(
PojoUtils
.
initErrorPojo
(
e
.
getMessage
())).
build
();
return
Response
.
serverError
().
entity
(
PojoUtils
.
initErrorPojo
(
e
.
getMessage
())).
build
();
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment