bug: get command incorrectly reports spaces error; evaluate_content_type uses singular URL prefixes
メンテナーはふだん 11 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
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
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
tableau/tabcmd のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 11 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 11 日以内に返信
-
feat: publish missing --description flag from tabcmd Classic対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 11 日以内に返信
-
feat: creategroup missing --role flag from tabcmd Classic対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 11 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 11 日以内に返信
似ている issue
-
style: article/section 📝 system: cloud.rc ☁️ system: security 🔐
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
uabrc/uabrc.github.io#1262 ·
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
NCAR/miles-credit#526 ·
-
documentation
難易度 1/5 1〜3時間 初心者へのやさしさ 76/100
conda/conda-lock#957 ·
メンテナーはふだん 1 日以内に返信
-
Type: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
aws-samples/sample-per-model-bedrock#464 ·
メンテナーはふだん 1 日以内に返信