Skip to main content

src/plume@download_options.erl

-module(plume@download_options).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/plume/download_options.gleam").
-export([to_string/1]).
-export_type([download_options/0]).

-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.

?MODULEDOC(
    " X-Download-Options\n"
    "\n"
    " This response header is specific to Internet Explorer 8. It instructs the\n"
    " browser to not open a downloaded file directly in the context of the site,\n"
    " preventing potential execution of HTML in the site's origin. Files must be\n"
    " saved before being opened.\n"
    "\n"
    " See the [Microsoft docs](https://learn.microsoft.com/en-us/archive/blogs/ie/ie8-security-part-v-comprehensive-protection).\n"
).

-type download_options() :: no_open.

-file("src/plume/download_options.gleam", 20).
?DOC(" Encode as the `X-Download-Options` header value.\n").
-spec to_string(download_options()) -> binary().
to_string(Value) ->
    case Value of
        no_open ->
            <<"noopen"/utf8>>
    end.