mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-23 20:28:06 +01:00
fix 404 when reacting with Keycap Number Sign
The Unicode sequence for this emoji starts with an ASCII # character, which the browser's URI parser truncates before sending the request to the backend.
This commit is contained in:
parent
c739d89b0c
commit
6cad7718eb
2 changed files with 8 additions and 4 deletions
|
@ -416,7 +416,9 @@ export const addReaction = (statusId, name, url) => (dispatch, getState) => {
|
|||
dispatch(addReactionRequest(statusId, name, url));
|
||||
}
|
||||
|
||||
api(getState).post(`/api/v1/statuses/${statusId}/react/${name}`).then(() => {
|
||||
// encodeURIComponent is required for the Keycap Number Sign emoji, see:
|
||||
// <https://github.com/glitch-soc/mastodon/pull/1980#issuecomment-1345538932>
|
||||
api(getState).post(`/api/v1/statuses/${statusId}/react/${encodeURIComponent(name)}`).then(() => {
|
||||
dispatch(addReactionSuccess(statusId, name));
|
||||
}).catch(err => {
|
||||
if (!alreadyAdded) {
|
||||
|
@ -448,7 +450,7 @@ export const addReactionFail = (statusId, name, error) => ({
|
|||
export const removeReaction = (statusId, name) => (dispatch, getState) => {
|
||||
dispatch(removeReactionRequest(statusId, name));
|
||||
|
||||
api(getState).post(`/api/v1/statuses/${statusId}/unreact/${name}`).then(() => {
|
||||
api(getState).post(`/api/v1/statuses/${statusId}/unreact/${encodeURIComponent(name)}`).then(() => {
|
||||
dispatch(removeReactionSuccess(statusId, name));
|
||||
}).catch(err => {
|
||||
dispatch(removeReactionFail(statusId, name, err));
|
||||
|
|
|
@ -436,7 +436,9 @@ export const addReaction = (statusId, name, url) => (dispatch, getState) => {
|
|||
dispatch(addReactionRequest(statusId, name, url));
|
||||
}
|
||||
|
||||
api(getState).post(`/api/v1/statuses/${statusId}/react/${name}`).then(() => {
|
||||
// encodeURIComponent is required for the Keycap Number Sign emoji, see:
|
||||
// <https://github.com/glitch-soc/mastodon/pull/1980#issuecomment-1345538932>
|
||||
api(getState).post(`/api/v1/statuses/${statusId}/react/${encodeURIComponent(name)}`).then(() => {
|
||||
dispatch(addReactionSuccess(statusId, name));
|
||||
}).catch(err => {
|
||||
if (!alreadyAdded) {
|
||||
|
@ -468,7 +470,7 @@ export const addReactionFail = (statusId, name, error) => ({
|
|||
export const removeReaction = (statusId, name) => (dispatch, getState) => {
|
||||
dispatch(removeReactionRequest(statusId, name));
|
||||
|
||||
api(getState).post(`/api/v1/statuses/${statusId}/unreact/${name}`).then(() => {
|
||||
api(getState).post(`/api/v1/statuses/${statusId}/unreact/${encodeURIComponent(name)}`).then(() => {
|
||||
dispatch(removeReactionSuccess(statusId, name));
|
||||
}).catch(err => {
|
||||
dispatch(removeReactionFail(statusId, name, err));
|
||||
|
|
Loading…
Reference in a new issue