aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-01-08 16:52:52 +0300
committerGravatar Vitaly Takmazov2023-01-08 16:52:52 +0300
commit8abdac5ade33c71125eb3f7409cb6dafe8aff278 (patch)
tree0a3c758785cdfc1bac8ca57edec06a7a09506a77 /src/main/java/com/juick
parent60bb2e97a7b9a883d40b1b48c280bfd48dd283e2 (diff)
Fix ActivityPub redirects
Diffstat (limited to 'src/main/java/com/juick')
-rw-r--r--src/main/java/com/juick/www/controllers/Site.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/main/java/com/juick/www/controllers/Site.java b/src/main/java/com/juick/www/controllers/Site.java
index cbc14496..1dc4c338 100644
--- a/src/main/java/com/juick/www/controllers/Site.java
+++ b/src/main/java/com/juick/www/controllers/Site.java
@@ -43,6 +43,7 @@ import org.springframework.security.web.WebAttributes;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.view.RedirectView;
import javax.inject.Inject;
import java.net.URLEncoder;
@@ -477,14 +478,14 @@ public class Site {
return "views/pm_sent";
}
- @GetMapping(value = "/{uname}/{mid}", produces = { Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITY_MEDIA_TYPE,
- Context.ACTIVITYSTREAMS_PROFILE_MEDIA_TYPE, MediaType.APPLICATION_JSON_VALUE })
- public String threadRedirect(@PathVariable int mid) {
+ @GetMapping(value = "/{uname}/{mid}", produces = { MediaType.APPLICATION_JSON_VALUE, Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITY_MEDIA_TYPE,
+ Context.ACTIVITYSTREAMS_PROFILE_MEDIA_TYPE })
+ public RedirectView threadRedirect(@PathVariable String uname, @PathVariable int mid) {
String linkedDataLocation = "/n/" + mid + "-0";
- return "redirect:" + linkedDataLocation;
+ return new RedirectView(linkedDataLocation);
}
- @GetMapping(value = "/{uname}/{mid}", consumes = MediaType.ALL_VALUE, produces = MediaType.TEXT_HTML_VALUE)
+ @GetMapping(value = "/{uname}/{mid}", produces = { MediaType.TEXT_HTML_VALUE, MediaType.ALL_VALUE })
protected String threadAction(@ModelAttribute User visitor, ModelMap model, @PathVariable String uname,
@PathVariable int mid,
@CookieValue(name = "sape_cookie", required = false, defaultValue = StringUtils.EMPTY) String sapeCookie) {