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
ac31a8d48d
commit
c1f4e493e9
|
@ -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