agusmakmun / agusmakmun/django-markdown-editor

Missing changes for static files to handle alternate CSRF cookie name

Đang mở
#292 1 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
901
Fork
1.3k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

PR #287 allowed configuring the CSRF cookie name.
It was merged to `master` in October 2025.
https://github.com/agusmakmun/django-markdown-editor/commit/a1a5acc464993843b283c76547ae8f67157b2291#diff-b63b71f1ace25c826f72468fc4212660d8590280af57bd8be0d962118d378ad0

History to individual JS file does not show the commit from October 2025:
https://github.com/agusmakmun/django-markdown-editor/commits/master/martor/static/martor/js/martor.bootstrap.js

One of the key changes for handling the new CSRF cookie name is replacing:
```
getCookie('csrftoken')
```

With this:
```
getCookie(textareaId.data('csrf-cookie-name')));
```

Current `master` and version 1.8.2 somehow show the old code:
```
'csrfmiddlewaretoken': getCookie('csrftoken')
```
https://github.com/agusmakmun/django-markdown-editor/blob/master/martor/static/martor/js/martor.bootstrap.js#L95

(Permalink for historical context:
https://github.com/agusmakmun/django-markdown-editor/blob/0bf92e6b224b3596b815230b697d5bb6c431a884/martor/static/martor/js/martor.bootstrap.js#L95 )

The odd thing is that the setting change does remain, only the JavaScript file changes seem to have gone missing:
https://github.com/agusmakmun/django-markdown-editor/blob/master/martor/settings.py#L225-L229

(Permalink: https://github.com/agusmakmun/django-markdown-editor/blob/0bf92e6b224b3596b815230b697d5bb6c431a884/martor/settings.py#L225-L229 )

## Details
- OS (Operating System) version: MacOS
- Browser and browser version: Chrome
- Django version: 5.2
- Martor version & theme: 1.8.2 (no theme)

### Steps to reproduce

1. Change Django's `CSRF_COOKIE_NAME` to something else, then change `MARTOR_CSRF_COOKIE_NAME`
2. Despite changing `MARTOR_CSRF_COOKIE_NAME` to match the Django cookie name, see that the form still fails

See the code change in version 1.7.16
https://github.com/agusmakmun/django-markdown-editor/blob/v1.7.16/martor/static/martor/js/martor.bootstrap.js#L157
The fix is gone in version 1.8.2
https://github.com/agusmakmun/django-markdown-editor/blob/v1.8.2/martor/static/martor/js/martor.bootstrap.js#L157

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.