Skip to content

Commit

Permalink
Merge pull request #142 from fsinfuhh/staging
Browse files Browse the repository at this point in the history
Fix Wiki Redirects with slash at end
  • Loading branch information
timonegk authored Oct 30, 2023
2 parents 8b74c10 + 05b1ff5 commit cb97e9f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
15 changes: 4 additions & 11 deletions mafiasi/etherpad/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from django import forms
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import Group
from django.core.exceptions import ObjectDoesNotExist
from django.shortcuts import redirect
from django.template.response import TemplateResponse
Expand Down Expand Up @@ -159,18 +160,10 @@ def pin_pad(request, group_name, pad_name):
@require_POST
def unpin_pad(request, group_name, pad_name):
try:
group = request.user.groups.get(name=group_name)
group = Group.objects.get(name=group_name)
PinnedEtherpad.objects.filter(user=request.user, group_name=group, pad_name=pad_name).delete()
except ObjectDoesNotExist:
return TemplateResponse(
request,
"etherpad/forbidden-notingroup.html",
{
"group_name": group_name,
},
status=403,
)

PinnedEtherpad.objects.filter(user=request.user, group_name=group, pad_name=pad_name).delete()
pass
# redirect to pad overview
return redirect("ep_index")

Expand Down
2 changes: 1 addition & 1 deletion mafiasi/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def handler500(request):
def handler404(request, exception):
try:
apps.get_app_config("wiki")
path = str(request.path).replace("/", "", 1)
path = str(request.path).strip("/")
if "/" in path:
return HttpResponse("Page not found", status=404)

Expand Down

0 comments on commit cb97e9f

Please sign in to comment.