fix: importing packages with scripts that have "." in the script name (#35784)

* fix: importing packages with scripts that have "." in the script name

* style: code formatting
This commit is contained in:
DennisOchulor 2026-01-29 16:37:11 +08:00 committed by GitHub
parent 7279b8e89d
commit 15602ce059
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -248,7 +248,7 @@ def load_code_properties(doc, path):
if hasattr(doc, "get_code_fields"): if hasattr(doc, "get_code_fields"):
dirname, filename = os.path.split(path) dirname, filename = os.path.split(path)
for key, extn in doc.get_code_fields().items(): for key, extn in doc.get_code_fields().items():
codefile = os.path.join(dirname, filename.split(".", 1)[0] + "." + extn) codefile = os.path.join(dirname, filename[: filename.rfind(".")] + "." + extn)
if os.path.exists(codefile): if os.path.exists(codefile):
with open(codefile) as txtfile: with open(codefile) as txtfile:
doc.set(key, txtfile.read()) doc.set(key, txtfile.read())