don't expose exception message

This commit is contained in:
Athou
2025-03-10 10:54:40 +01:00
parent da690aa750
commit 6641bc0631

View File

@@ -77,6 +77,7 @@ import com.google.common.base.Throwables;
import com.rometools.opml.feed.opml.Opml; import com.rometools.opml.feed.opml.Opml;
import com.rometools.rome.feed.synd.SyndFeed; import com.rometools.rome.feed.synd.SyndFeed;
import com.rometools.rome.feed.synd.SyndFeedImpl; import com.rometools.rome.feed.synd.SyndFeedImpl;
import com.rometools.rome.io.FeedException;
import com.rometools.rome.io.SyndFeedOutput; import com.rometools.rome.io.SyndFeedOutput;
import com.rometools.rome.io.WireFeedOutput; import com.rometools.rome.io.WireFeedOutput;
@@ -508,16 +509,12 @@ public class FeedREST {
@Transactional @Transactional
@Produces(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML)
@Operation(summary = "OPML export", description = "Export an OPML file of the user's subscriptions") @Operation(summary = "OPML export", description = "Export an OPML file of the user's subscriptions")
public Response exportOpml() { public Response exportOpml() throws FeedException {
User user = authenticationContext.getCurrentUser(); User user = authenticationContext.getCurrentUser();
Opml opml = opmlExporter.export(user); Opml opml = opmlExporter.export(user);
WireFeedOutput output = new WireFeedOutput(); WireFeedOutput output = new WireFeedOutput();
String opmlString; String opmlString = output.outputString(opml);
try {
opmlString = output.outputString(opml);
} catch (Exception e) {
return Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
}
return Response.ok(opmlString).build(); return Response.ok(opmlString).build();
} }