Skip to content

Commit 68b7656

Browse files
committed
fix(q-dev): fix scope ID routing and CSV/JSON file separation
Three fixes: 1. Use *scopeId (catch-all) route pattern instead of :scopeId so scope IDs containing "/" (e.g. "034362076319/2026") work in URL paths 2. CSV extractor now filters for .csv files only, preventing it from trying to parse .json.gz logging files as CSV 3. Frontend scope API calls now encodeURIComponent(scopeId) for safe URL encoding
1 parent 8796f0f commit 68b7656

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

backend/plugins/q_dev/impl/impl.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,12 @@ func (p QDev) ApiResources() map[string]map[string]plugin.ApiResourceHandler {
188188
"GET": api.GetScopeList,
189189
"PUT": api.PutScopes,
190190
},
191-
"connections/:connectionId/scopes/:scopeId": {
191+
"connections/:connectionId/scopes/*scopeId": {
192192
"GET": api.GetScope,
193193
"PATCH": api.PatchScope,
194194
"DELETE": api.DeleteScope,
195195
},
196-
"connections/:connectionId/scopes/:scopeId/latest-sync-state": {
196+
"connections/:connectionId/scopes/*scopeId/latest-sync-state": {
197197
"GET": api.GetScopeLatestSyncState,
198198
},
199199
}

backend/plugins/q_dev/tasks/s3_data_extractor.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ func ExtractQDevS3Data(taskCtx plugin.SubTaskContext) errors.Error {
4040
data := taskCtx.GetData().(*QDevTaskData)
4141
db := taskCtx.GetDal()
4242

43-
// 查询未处理的文件元数据
43+
// 查询未处理的CSV文件元数据(排除.json.gz日志文件)
4444
cursor, err := db.Cursor(
4545
dal.From(&models.QDevS3FileMeta{}),
46-
dal.Where("connection_id = ? AND processed = ?", data.Options.ConnectionId, false),
46+
dal.Where("connection_id = ? AND processed = ? AND file_name LIKE ?",
47+
data.Options.ConnectionId, false, "%.csv"),
4748
)
4849
if err != nil {
4950
return errors.Default.Wrap(err, "failed to get file metadata cursor")

config-ui/src/api/scope/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ export const list = (
3838
});
3939

4040
export const get = (plugin: string, connectionId: ID, scopeId: ID, payload?: { blueprints: boolean }) =>
41-
request(`/plugins/${plugin}/connections/${connectionId}/scopes/${scopeId}`, {
41+
request(`/plugins/${plugin}/connections/${connectionId}/scopes/${encodeURIComponent(scopeId)}`, {
4242
data: payload,
4343
});
4444

4545
export const remove = (plugin: string, connectionId: ID, scopeId: ID, onlyData: boolean) =>
46-
request(`/plugins/${plugin}/connections/${connectionId}/scopes/${scopeId}?delete_data_only=${onlyData}`, {
46+
request(`/plugins/${plugin}/connections/${connectionId}/scopes/${encodeURIComponent(scopeId)}?delete_data_only=${onlyData}`, {
4747
method: 'delete',
4848
});
4949

5050
export const update = (plugin: string, connectionId: ID, scopeId: ID, payload: any) =>
51-
request(`/plugins/${plugin}/connections/${connectionId}/scopes/${scopeId}`, {
51+
request(`/plugins/${plugin}/connections/${connectionId}/scopes/${encodeURIComponent(scopeId)}`, {
5252
method: 'patch',
5353
data: payload,
5454
});

0 commit comments

Comments
 (0)