From 5604374691367fbfdf302f9d6499b5e0ad7a1787 Mon Sep 17 00:00:00 2001 From: Athou Date: Sun, 2 Jun 2013 10:41:47 +0200 Subject: [PATCH] check the public url before importing --- .../com/commafeed/frontend/rest/resources/FeedREST.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/com/commafeed/frontend/rest/resources/FeedREST.java b/src/main/java/com/commafeed/frontend/rest/resources/FeedREST.java index 64d9d1f7..63f943eb 100644 --- a/src/main/java/com/commafeed/frontend/rest/resources/FeedREST.java +++ b/src/main/java/com/commafeed/frontend/rest/resources/FeedREST.java @@ -337,6 +337,14 @@ public class FeedREST extends AbstractResourceREST { @Consumes(MediaType.MULTIPART_FORM_DATA) @ApiOperation(value = "OPML import", notes = "Import an OPML file, posted as a FORM with the 'file' name") public Response importOpml() { + + String publicUrl = applicationSettingsService.get().getPublicUrl(); + if (StringUtils.isBlank(publicUrl)) { + throw new WebApplicationException(Response + .status(Status.INTERNAL_SERVER_ERROR) + .entity("Set the public URL in the admin section.").build()); + } + if (StartupBean.USERNAME_DEMO.equals(getUser().getName())) { return Response.status(Status.UNAUTHORIZED) .entity("Import is disabled for the demo account").build();