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

feat: adding ctype option to mv_createfile.sas macro #311

Merged
merged 2 commits into from
Sep 13, 2022

Conversation

allanbowe
Copy link
Member

@allanbowe allanbowe commented Sep 6, 2022

Issue

#310

Intent

Enable the developer to specify the content type of a file in SAS Drive

Implementation

Added a content-type option (&ctype) to mv_createfile.sas

Checks

  • Code is formatted correctly (sasjs lint).
  • Any new functionality has been unit tested.
  • All unit tests are passing (sasjs test).

@gitpod-io
Copy link

gitpod-io bot commented Sep 6, 2022

@allanbowe
Copy link
Member Author

Can be tested with this snippet:

filename mc url "https://raw.githubusercontent.com/sasjs/core/07d7c9df4b8261cf6327135c9e992295f5ba04a6/all.sas";
%inc mc;

filename filecode temp lrecl=32767;
data _null_;
file filecode;
 put 'PCFET0NUWVBFIGh0bWw+CjxodG1sPgoKPGhlYWQ+CiAgPG1ldGEgY2hhcnNldD0idXRmLTgiIGh0dHAtZXF1aXY9IlgtVUEtQ29tcGF0aWJsZSIgY29udGVudD0iSUU9ZWRnZSIgLz4KICA8bGluayByZWw9InNob3J0Y3V0IGljb24iIGhyZWY9Ii4vZmF2aWNvbi5pY28iIC8+CiAgPGxpbmsg'@;
 put 'aHJlZj0iaHR0cHM6Ly9mb250cy5nb29nbGVhcGlzLmNvbS9jc3M/ZmFtaWx5PVJvYm90byZkaXNwbGF5PXN3YXAiIHJlbD0ic3R5bGVzaGVldCIgLz4KICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9InN0eWxlLmNzcyIgLz4KICA8c2NyaXB0PgogICAgZnVuY3Rpb24gaW5pdFNhc0pz'@;
 put 'KCkgewogICAgICBzYXNqcyA9IG5ldyBTQVNqcy5kZWZhdWx0KHsKICAgICAgICBhcHBMb2M6ICcvUHVibGljL2FwcC9taW5pbWFsLXNlZWQtYXBw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
run;
%mv_createfile(path=/Public/app/minimal-seed-app2/services/web
  , name=index.html
  , inref=filecode
  , intype=BASE64
  , ctype=%str(text/html)
)

@allanbowe allanbowe linked an issue Sep 13, 2022 that may be closed by this pull request
@allanbowe allanbowe merged commit 984ea44 into main Sep 13, 2022
@allanbowe allanbowe deleted the allanbowe/mv-createfile-needs-a-310 branch September 13, 2022 19:37
@sasjsbot
Copy link

🎉 This PR is included in version 4.39.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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 this pull request may close these issues.

mv_createfile needs a content-type option
2 participants