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 CSV Data File export (Resolves #198) #199

Merged
merged 1 commit into from
Apr 3, 2024
Merged

Fix CSV Data File export (Resolves #198) #199

merged 1 commit into from
Apr 3, 2024

Conversation

smarr
Copy link
Owner

@smarr smarr commented Apr 3, 2024

Before this PR, we used the project name, which can contain arbitrary unsafe characters.
Though, the project slug is already safe.

So, we just use that one.

It's safe, because projects are created in recordProject() with

INSERT INTO Project (name, slug)
  VALUES ($1, regexp_replace($2, '[^0-9a-zA-Z-]', '-', 'g'))
  RETURNING *

This means, all none number and a-z characters are replaced with - and made safe.

See

public async recordProject(projectName: string): Promise<Project> {
return this.recordCached(
this.projects,
projectName,
{
name: 'fetchProjectByName',
text: this.queries.fetchProjectByName,
values: [projectName]
},
{
name: 'insertProject',
text: `INSERT INTO Project (name, slug)
VALUES ($1, regexp_replace($2, '[^0-9a-zA-Z-]', '-', 'g'))
RETURNING *`,

Projects are created in `recordProject()` with

INSERT INTO Project (name, slug)
  VALUES ($1, regexp_replace($2, '[^0-9a-zA-Z-]', '-', 'g'))
  RETURNING *

This means, all none number and a-z characters are replaced with - and made safe.

Signed-off-by: Stefan Marr <[email protected]>
@smarr smarr merged commit 5e19273 into master Apr 3, 2024
2 checks passed
@smarr smarr deleted the data-export branch April 3, 2024 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant