Skip to content

fix: use explicit extension check in get_file_type_from_filename (#256)#406

Merged
jacalata merged 5 commits into
developmentfrom
jac/fix-256-filename-extension
Jul 1, 2026
Merged

fix: use explicit extension check in get_file_type_from_filename (#256)#406
jacalata merged 5 commits into
developmentfrom
jac/fix-256-filename-extension

Conversation

@jacalata

Copy link
Copy Markdown
Contributor

Summary

  • Rewrites get_file_type_from_filename to check valid extensions explicitly: filename extension takes precedence, falls back to URL extension if filename has none, exits with error if neither is recognized
  • Fixes the previous behaviour where a path containing dots (e.g. C:\user.name\file) could produce a wrong filetype

Closes #256

Test plan

  • test_filename_extension_overrides_url_extension
  • test_filename_without_extension_falls_back_to_url_extension
  • test_no_filename_falls_back_to_url_extension
  • test_no_valid_extension_anywhere_exits

jacalata and others added 4 commits May 5, 2026 16:24
When a user supplies -f output.csv with a URL that has a different
extension (e.g. view.png), the file type is now determined from the
user-supplied filename extension. If the filename has no recognized
extension, or no filename is given, the URL extension is used as
the fallback. Adds three tests covering the three cases.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add test covering the case where neither filename nor URL has a
recognized extension, which should exit with an error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown

Coverage

Coverage Report
FileStmtsMissCoverMissing
tabcmd
   __main__.py101010 0%
   tabcmd.py141414 0%
   version.py633 50%
tabcmd/commands
   commands.py101010 0%
   constants.py771818 77%
   server.py1351818 87%
tabcmd/commands/auth
   session.py3704646 88%
tabcmd/commands/datasources_and_workbooks
   datasources_and_workbooks_command.py1561818 88%
   datasources_workbooks_views_url_parser.py14155 96%
   delete_command.py601616 73%
   export_command.py1192525 79%
   get_url_command.py1274747 63%
   publish_command.py1232828 77%
   runschedule_command.py2177 67%
tabcmd/commands/extracts
   create_extracts_command.py4288 81%
   decrypt_extracts_command.py2722 93%
   delete_extracts_command.py3766 84%
   encrypt_extracts_command.py2722 93%
   extracts.py2022 90%
   reencrypt_extracts_command.py2722 93%
   refresh_extracts_command.py481010 79%
tabcmd/commands/group
   create_group_command.py2955 83%
   delete_group_command.py2722 93%
tabcmd/commands/project
   create_project_command.py4688 83%
   delete_project_command.py3544 89%
   publish_samples_command.py3044 87%
tabcmd/commands/site
   create_site_command.py3455 85%
   delete_site_command.py2722 93%
   edit_site_command.py3822 95%
   list_command.py771212 84%
   list_sites_command.py2922 93%
tabcmd/commands/user
   create_site_users.py571010 82%
   create_users_command.py601010 83%
   delete_site_users_command.py4355 88%
   user_data.py2213131 86%
tabcmd/execution
   _version.py222 0%
   global_options.py12588 94%
   localize.py661111 83%
   logger_config.py4266 86%
   tabcmd_controller.py4277 83%
TOTAL280443385% 

@jacalata jacalata merged commit 02e9aba into development Jul 1, 2026
20 checks passed
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.

2 participants