fix: 修复 sendOn 可能被绕过的问题 (#5978)

* 发布新版

* fix: 修复 sendOn 可能被绕过的问题

* fix: 修复请求体无法是数组的问题
This commit is contained in:
liaoxuezhi 2022-12-26 16:10:53 +08:00 committed by GitHub
parent c3d32ad10d
commit 9d18904eef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 23 deletions

View File

@ -1,4 +1,6 @@
{
"packages": ["packages/*"],
"version": "2.5.1"
"packages": [
"packages/*"
],
"version": "2.5.2"
}

View File

@ -1,6 +1,6 @@
{
"name": "amis-core",
"version": "2.5.1",
"version": "2.5.2",
"description": "amis-core",
"main": "lib/index.js",
"module": "esm/index.js",
@ -45,7 +45,7 @@
"esm"
],
"dependencies": {
"amis-formula": "^2.5.1",
"amis-formula": "^2.5.2",
"classnames": "2.3.1",
"file-saver": "^2.0.2",
"hoist-non-react-statics": "^3.3.2",

View File

@ -175,7 +175,7 @@ export function buildApi(
api.method === 'put' ||
api.method === 'patch'
) {
api.body = api.data = cloneObject(data);
api.body = api.data = data;
}
// get 类请求,把 data 附带到 url 上。
@ -617,8 +617,6 @@ export function isApiOutdated(
): nextApi is Api {
if (!nextApi) {
return false;
} else if (!prevApi) {
return true;
}
nextApi = normalizeApi(nextApi);
@ -628,22 +626,30 @@ export function isApiOutdated(
}
const trackExpression = nextApi.trackExpression ?? nextApi.url;
if (typeof trackExpression !== 'string' || !~trackExpression.indexOf('$')) {
return false;
}
prevApi = normalizeApi(prevApi);
let isModified = false;
if (nextApi.trackExpression || prevApi.trackExpression) {
isModified =
tokenize(prevApi.trackExpression || '', prevData) !==
tokenize(nextApi.trackExpression || '', nextData);
if (prevApi) {
prevApi = normalizeApi(prevApi);
if (nextApi.trackExpression || prevApi.trackExpression) {
isModified =
tokenize(prevApi.trackExpression || '', prevData) !==
tokenize(nextApi.trackExpression || '', nextData);
} else {
prevApi = buildApi(prevApi as Api, prevData as object, {
ignoreData: true
});
nextApi = buildApi(nextApi as Api, nextData as object, {
ignoreData: true
});
isModified = prevApi.url !== nextApi.url;
}
} else {
prevApi = buildApi(prevApi as Api, prevData as object, {ignoreData: true});
nextApi = buildApi(nextApi as Api, nextData as object, {ignoreData: true});
isModified = prevApi.url !== nextApi.url;
isModified = true;
}
return !!(

View File

@ -1,6 +1,6 @@
{
"name": "amis-formula",
"version": "2.5.1",
"version": "2.5.2",
"description": "负责 amis 里面的表达式实现,内置公式,编辑器等",
"main": "lib/index.js",
"module": "esm/index.js",

View File

@ -3,7 +3,7 @@
"main": "lib/index.js",
"module": "esm/index.js",
"types": "lib/index.d.ts",
"version": "2.5.1",
"version": "2.5.2",
"description": "",
"scripts": {
"build": "npm run clean-dist && NODE_ENV=production rollup -c ",
@ -35,8 +35,8 @@
},
"dependencies": {
"@rc-component/mini-decimal": "^1.0.1",
"amis-core": "^2.5.1",
"amis-formula": "^2.5.1",
"amis-core": "^2.5.2",
"amis-formula": "^2.5.2",
"classnames": "2.3.1",
"codemirror": "^5.63.0",
"downshift": "6.1.12",

View File

@ -1,6 +1,6 @@
{
"name": "amis",
"version": "2.5.1",
"version": "2.5.2",
"description": "一种MIS页面生成工具",
"main": "lib/index.js",
"module": "esm/index.js",
@ -41,8 +41,8 @@
]
},
"dependencies": {
"amis-core": "^2.5.1",
"amis-ui": "^2.5.1",
"amis-core": "^2.5.2",
"amis-ui": "^2.5.2",
"attr-accept": "2.2.2",
"blueimp-canvastoblob": "2.1.0",
"classnames": "2.3.1",