UserItem.CSVImport.create_from_file: wrong file-extension check

オープン 初心者向け
#1,865 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

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

調査の方向性

users_endpoint.py の Users.create_from_file から始め、非推奨化の動作と現在の呼び出し元を確認してください。リストされている小文字、大文字、部分文字列、non-CSV のパスを検証し、そのうえで、非推奨化期間中にバリデーションを修正するのか、削除までそのままにするのかという選択した方針が、プロジェクトの決定と一致していることを確認してください。

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

説明

Users.create_from_file (in users_endpoint.py) validates the file with "csv" not in filepath before parsing. That test:

  • accepts non-CSV files whose path merely contains the substring csv (e.g. report.csv.bak, mycsv.txt, /home/csvuser/data.json)
  • rejects valid files whose extension is uppercase (e.g. USERS.CSV)

Neither matches the error message ("Only csv files are accepted").

Fix would be Path(filepath).suffix.lower() == ".csv".

Note: create_from_file is already deprecated (emits DeprecationWarning and is being replaced by bulk_add). Two paths:

  1. Patch under the deprecation window so the last few callers get correct behavior until removal.
  2. Just delete the method when the deprecation window closes and don't touch it in the meantime.

Filed as follow-up to a review comment on PR #1812 (out of scope for that PR's refactor).

主要言語
Python
スター
716
フォーク
446
平均マージ
8日 8時間
マージ済み PR(30日)
2

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

tableau/server-client-python のほかの issue

tableau/server-client-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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