sasjs / core

Macros for SAS® App Developers
https://core.sasjs.io
MIT License
119 stars 17 forks source link

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

Closed allanbowe closed 2 years ago

allanbowe commented 2 years ago

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

gitpod-io[bot] commented 2 years ago

allanbowe commented 2 years ago

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 'KCkgewogICAgICBzYXNqcyA9IG5ldyBTQVNqcy5kZWZhdWx0KHsKICAgICAgICBhcHBMb2M6ICcvUHVibGljL2FwcC9taW5pbWFsLXNlZWQtYXBwJywKICAgICAgICBzZXJ2ZXJUeXBlOiAnU0FTSlMnLAogICAgICAgIHNlcnZlclVybDogJycsCiAgICAgICAgZGVidWc6IGZhbHNlLAogICAg'@;
 put 'ICAgIGxvZ2luTWVjaGFuaXNtOiAnUmVkaXJlY3RlZCcKICAgICAgfSkKICAgICAgc2FzanMuY2hlY2tTZXNzaW9uKCkudGhlbigocmVzKSA9PiB7CiAgICAgICAgaWYgKHJlcy5pc0xvZ2dlZEluKSBhZnRlckxvZ2luKCkKICAgICAgfSkKICAgIH0KICA8L3NjcmlwdD4KICA8c2NyaXB0IHNy'@;
 put 'Yz0ic2FzanMuanMiPjwvc2NyaXB0PgogIDxzY3JpcHQgc3JjPSJzY3JpcHRzLmpzIj48L3NjcmlwdD4KPC9oZWFkPgoKPGJvZHkgb25sb2FkPSJpbml0U2FzSnMoKSI+CiAgPGgxPkhlbGxvITwvaDE+CiAgPGgxPgogICAgV2VsY29tZSB0byB0aGUgVmFuaWxsYSBKUyBTZWVkIEFwcCBmb3Ig'@;
 put 'PHNwYW4gY2xhc3M9ImNvZGUiPlNBU2pzPC9zcGFuPiEKICA8L2gxPgogIDxkaXYgY2xhc3M9ImxvZ2luLWZvcm0iIGlkPSJsb2dpbi1mb3JtIj4KICAgIDxpbnB1dCB0eXBlPSJ0ZXh0IiBpZD0idXNlcm5hbWUiIHBsYWNlaG9sZGVyPSJFbnRlciB1c2VybmFtZSIgLz4KICAgIDxpbnB1dCB0'@;
 put 'eXBlPSJwYXNzd29yZCIgaWQ9InBhc3N3b3JkIiBwbGFjZWhvbGRlcj0iRW50ZXIgcGFzc3dvcmQiIC8+CiAgPC9kaXY+CiAgPGJ1dHRvbiBpZD0ibG9naW4iIG9uY2xpY2s9ImxvZ2luKCkiPkxvZyBpbjwvYnV0dG9uPgogIDxkaXYgaWQ9ImRhdGEtY29udGFpbmVyIiBzdHlsZT0iZGlzcGxh'@;
 put 'eTogbm9uZSI+PC9kaXY+CjwvYm9keT4KCjwvaHRtbD4K';
run;
%mv_createfile(path=/Public/app/minimal-seed-app2/services/web
  , name=index.html
  , inref=filecode
  , intype=BASE64
  , ctype=%str(text/html)
)
sasjsbot commented 2 years ago

:tada: This PR is included in version 4.39.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: