Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: encode rison characters when searching #16768

Merged
merged 1 commit into from
Sep 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ flask==1.1.4
# flask-openid
# flask-sqlalchemy
# flask-wtf
flask-appbuilder==3.3.2
flask-appbuilder==3.3.3
# via apache-superset
flask-babel==1.0.0
# via flask-appbuilder
Expand Down Expand Up @@ -176,7 +176,7 @@ pgsanity==0.2.9
# via apache-superset
polyline==1.4.0
# via apache-superset
prison==0.1.3
prison==0.2.1
# via flask-appbuilder
pyarrow==4.0.1
# via apache-superset
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def get_git_sha() -> str:
"cryptography>=3.3.2",
"deprecation>=2.1.0, <2.2.0",
"flask>=1.1.0, <2.0.0",
"flask-appbuilder>=3.3.2, <4.0.0",
"flask-appbuilder>=3.3.3, <4.0.0",
"flask-caching>=1.10.0",
"flask-compress",
"flask-talisman",
Expand Down
3 changes: 2 additions & 1 deletion superset-frontend/src/components/ListView/Filters/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export default function SearchFilter({
const [value, setValue] = useState(initialValue || '');
const handleSubmit = () => {
if (value) {
onSubmit(value.trim());
// encode plus signs to prevent them from being converted into a space
onSubmit(value.trim().replace(/\+/g, '%2B'));
}
};
const onClear = () => {
Expand Down
5 changes: 3 additions & 2 deletions superset-frontend/src/components/ListView/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ import {
ViewModeType,
} from './types';

// Define custom RisonParam for proper encoding/decoding
// Define custom RisonParam for proper encoding/decoding; note that
// plus symbols should be encoded to avoid being converted into a space
const RisonParam: QueryParamConfig<string, any> = {
encode: (data?: any | null) =>
data === undefined ? undefined : rison.encode(data),
data === undefined ? undefined : rison.encode(data).replace(/\+/g, '%2B'),
decode: (dataStr?: string | string[]) =>
dataStr === undefined || Array.isArray(dataStr)
? undefined
Expand Down