-
Notifications
You must be signed in to change notification settings - Fork 651
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
[ch112819] Error importing KML files with slashes in 'name' nodes #15897
[ch112819] Error importing KML files with slashes in 'name' nodes #15897
Conversation
Can you please explain the relation between the CH ticket and this? Maybe it's wrong. Also, pinging @jgoizueta since he has been solving many issues in the different importers similar to this one and he's aware of the many implications a change like this can have in the service. |
@Algunenano You are right, I was working with another story and I added the wrong one. It is updated now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some minor comments. Good work and good idea trying to reuse core rails methods 💪 🎉
services/importer/spec/fixtures/multiple_layer_with_problematic_names.kml
Outdated
Show resolved
Hide resolved
Hey, a couple of questions to have in mind: The final names of tables generated by imports are sanitized and adapted to PG requirements here: Lines 1298 to 1305 in 97688bf
But for KML layers we need first to make sure we have names that are valid for the filesystem. And we have to take care with existing sync tables: if we change the name of the generated table we make break them. This means we should alter only layer names that would cause errors (invalid file names) and not layer names that currently cause no error, so could be in use in some sync, or we could make sure the transmormations performed are consistent with 😅 Hey I feel I'm bringing too much complication into a simple matter 🤔 I'm tempted to check if there are any sync tables at all in production using KML files, if there aren't we could save ourselves some trouble. If we know KML syncs aren't too common I wouldn't care for these details. |
We also have this intented to produced valid file names (and it seems used by Carto::ValidTableNameProposer cartodb/lib/carto/file_system/sanitize.rb Lines 7 to 13 in 97688bf
Maybe the ActiveStorage method is more comprehensive, but I think this will be good enough for our purposes, and since it's been used finally for filenames there should be less chance of altering the final result. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use Carto::FileSystem::Sanitize.sanitize_identifier
for consistency with table naming and other uses.
If you find the ActiveStorage
sanitize method has some advantage I would incorporate it into our method (but beware of altering existing syncs).
@jgoizueta Thank you very much, I think using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🏁
Resources
Changes