Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

bug: get command incorrectly reports spaces error; evaluate_content_type uses singular URL prefixes

オープン
#430 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 11 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
65/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
python
領域
cli

調査の方向性

Start in tabcmd/commands/datasources_and_workbooks/get_url_command.py at the spaces check and evaluate_content_type, then inspect validate_and_extract_url_parts in datasources_workbooks_views_url_parser.py. Reproduce the Windows runtime value of args.url and confirm the workbook get path, then make content-type detection use the documented plural prefixes and verify that valid URLs work without false space errors.

索引モデルが issue の本文から書いたものです。

説明

Observed behaviour

Running tabcmd get "/workbooks/WorkbookWithoutExtract.twbx" --no-certcheck (no spaces in the URL) produces:

The name of the workbook or view to export cannot include spaces. Use the normalized name of the workbook or view as it appears in the URL.
Exiting...

The workbook exists on the server and the URL contains no spaces.

Investigation findings

The spaces check at get_url_command.py:45 (if " " in args.url) should be False for this input. The secondary spaces check in datasources_workbooks_views_url_parser.py:46 (validate_and_extract_url_parts) is unreachable from the workbook get path — it is only called for view-type URLs. The root cause of the observed error has not yet been fully reproduced in isolation; further debugging is needed to confirm what value args.url actually holds at runtime on Windows.

Confirmed latent bug in evaluate_content_type

get_url_command.py:62-64:

valid_content_types = ["workbook", "view", "datasource"]  # singular
...
if url.find(content_type) == 0:   # matches "workbooks/..." via substring accident

The URL prefixes used in practice are plural (workbooks/, views/, datasources/). The match works by accident because "workbooks/...".find("workbook") == 0, but it is fragile — any URL starting with "workbook" (e.g. a hypothetical "workbookshelf/...") would also match. The correct fix is:

url_prefix_to_content_type = {
    "workbooks/": "workbook",
    "views/": "view",
    "datasources/": "datasource",
}
for prefix, content_type in url_prefix_to_content_type.items():
    if url.startswith(prefix):
        return content_type
Errors.exit_with_error(logger, message=_("tabcmd.error.bad_request.invalid_content_type").format(url))

Files

  • tabcmd/commands/datasources_and_workbooks/get_url_command.py — evaluate_content_type (line 57) and spaces check (line 45)
  • tabcmd/commands/datasources_and_workbooks/datasources_workbooks_views_url_parser.py — validate_and_extract_url_parts (line 44)
主要言語
Python
スター
52
フォーク
17
平均マージ
11日 11時間
マージ済み PR(30日)
4

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

tableau/tabcmd のほかの issue

tableau/tabcmd の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。