UserItem.CSVImport.create_from_file: wrong file-extension check

Đang mở Phù hợp với người mới
#1,865 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
70/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python
Lĩnh vực
api

Hướng nghiên cứu

Bắt đầu trong users_endpoint.py tại Users.create_from_file và xem xét hành vi deprecation của nó cùng các caller hiện tại. Xác minh các path lowercase, uppercase, substring và non-CSV được liệt kê, sau đó xác nhận rằng cách tiếp cận đã chọn — sửa validation trong thời gian deprecation hay để đến khi removal — phù hợp với quyết định của dự án.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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).

Ngôn ngữ chính
Python
Star
716
Fork
446
Merge trung bình
8 ngày 8 giờ
Pull request đã merge (30 ngày)
2

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của tableau/server-client-python

Tất cả issue của tableau/server-client-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.