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

Enh/only forbid uppercase ascii #3416

Merged
merged 2 commits into from
Jan 24, 2024
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 core/src/databases/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,11 @@ impl Table {
None => Err(anyhow!("Row {} is not an object", row_index,))?,
};
match object.keys().find(|key| match key.chars().next() {
Some(c) => !c.is_ascii_lowercase(),
Some(c) => c.is_ascii_uppercase(),
None => false,
}) {
Some(key) => Err(anyhow!(
"Row {} has a key '{}' that is not lowercase",
"Row {} has a key '{}' that contains uppercase characters",
row_index,
key
))?,
Expand Down
19 changes: 19 additions & 0 deletions front/pages/api/w/[wId]/data_sources/[name]/tables/csv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,25 @@ async function handler(
"Failed to upsert rows."
);

const delRes = await coreAPI.deleteTable({
projectId: dataSource.dustAPIProjectId,
dataSourceName: dataSource.name,
tableId,
});

if (delRes.isErr()) {
logger.error(
{
dataSourceName: dataSource.name,
workspaceId: owner.id,
tableId,
tableName: name,
error: delRes.error,
},
"Failed to delete table after failed upsert."
);
}

return apiError(req, res, {
status_code: 500,
api_error: {
Expand Down
Loading