Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[zos-files] upload_file_to_dsn does not convert Windows line endings #104

Closed
t1m0thyj opened this issue Aug 5, 2022 · 3 comments
Closed
Assignees
Labels

Comments

@t1m0thyj
Copy link
Member

t1m0thyj commented Aug 5, 2022

When uploading a file with Windows line endings, the \r\n line endings turn into double line endings.

The expected behavior is that (unless the file is uploaded in binary mode) the line endings would be converted to Unix (\n).

@t1m0thyj
Copy link
Member Author

The following snippet can be used to test uploading/downloading a file for this issue (and #179).

from decouple import config
from zowe.zos_files_for_zowe_sdk import Files

profile = {
    "host": "<zosmfHost>",
    "port": 443,
    "rejectUnauthorized": True,
    "user": config("ZOWE_OPT_USER"),
    "password": config("ZOWE_OPT_PASSWORD")
}
dsname = "<testDsname>"
files_api = Files(profile)
files_api.upload_file_to_dsn("test-upload.txt", dsname)
files_api.download_dsn(dsname, "test-download.txt")

@t1m0thyj
Copy link
Member Author

I think in order to fix this, we'll need to add a "binary" option to the upload_file_to_dsn method.

When this option is true, we can open the input file in rb mode and upload it without any processing.

When this option is false, we can open the file in r mode which will normalize new lines before uploading - according to the docs Python's default behavior is to replace \r\n with \n.

@t1m0thyj t1m0thyj added this to the z/OSMF Files and Jobs APIs milestone May 31, 2023
@t1m0thyj t1m0thyj moved this to Medium Priority in Zowe CLI Squad Dec 26, 2023
@zFernand0 zFernand0 removed this from the z/OSMF Files and Jobs APIs milestone Apr 25, 2024
@zFernand0 zFernand0 added this to the z/OSMF Enhancements milestone May 17, 2024
@pem70 pem70 self-assigned this Jun 3, 2024
@adam-wolfe
Copy link

Fix implemented in #276

@github-project-automation github-project-automation bot moved this from Medium Priority to Closed in Zowe CLI Squad Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants