HTML Export - notes with / in the name are not properly escaped #13

Closed
opened 4 years ago by garrettmills · 0 comments
Owner

This results in errors when exporting to the FS, because the file name has a / char in it. This needs to be escaped.

From the request error log:

{
    "_id" : ObjectId("5f8d8ff8fd8dac3458c2bc87"),
    "timestamp" : ISODate("2020-10-19T13:09:12.288Z"),
    "request" : {
        "headers" : {
            "host" : "noded.garrettmills.dev",
            "accept-encoding" : "gzip",
            "cf-ipcountry" : "US",
            "x-forwarded-for" : "2001:48f8:9021:970:a496:cc45:379c:5b91, 108.162.216.243",
            "cf-ray" : "5e4abb6df86830aa-ORD",
            "x-forwarded-proto" : "https",
            "cf-visitor" : "{\"scheme\":\"https\"}",
            "user-agent" : "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0",
            "accept" : "application/json, text/plain, */*",
            "accept-language" : "en-US,en;q=0.5",
            "content-type" : "application/json",
            "origin" : "https://noded.garrettmills.dev",
            "dnt" : "1",
            "referer" : "https://noded.garrettmills.dev/i/editor;id=82a6783d-25b8-41c1-a384-31e8e9bb5306",
            "pragma" : "no-cache",
            "cache-control" : "no-cache",
            "cookie" : "...",
            "cf-request-id" : "05e29378c0000030aaa4bd6000000001",
            "cf-connecting-ip" : "2001:48f8:9021:970:a496:cc45:379c:5b91",
            "cdn-loop" : "cloudflare",
            "x-forwarded-host" : "noded.garrettmills.dev",
            "x-forwarded-server" : "noded.garrettmills.dev",
            "content-length" : "65",
            "connection" : "Keep-Alive"
        },
        "url" : "/api/v1/exports/subtree",
        "method" : "POST",
        "baseUrl" : "",
        "originalUrl" : "/api/v1/exports/subtree",
        "params" : {},
        "query" : {},
        "body" : {
            "format" : "html",
            "PageId" : "a192c4e8-7633-46e0-a811-9f0c66b63ad4"
        },
        "session_id" : "d86a8f1a-862d-402d-b118-a17bf82b8429",
        "files" : {}
    },
    "is_auth" : true,
    "user_id" : "5f8c9f3cd9d4dd2fd69b3744",
    "additional_data" : {},
    "response" : {
        "status_code" : 500,
        "message" : "ENOENT: no such file or directory, open '/tmp/tmp-13400-5rmaGToveFeg/export/Creamy-Lentils-w/-Kale-Artichoke-Saute-f9eb886e-71bc-4554-9a17-0ef1170ae571.html'",
        "data" : {}
    },
    "error" : {
        "message" : "Error: ENOENT: no such file or directory, open '/tmp/tmp-13400-5rmaGToveFeg/export/Creamy-Lentils-w/-Kale-Artichoke-Saute-f9eb886e-71bc-4554-9a17-0ef1170ae571.html'",
        "stack" : [],
        "context" : {
            "request_path" : "/subtree",
            "request_query" : {},
            "request_body" : {
                "format" : "html",
                "PageId" : "a192c4e8-7633-46e0-a811-9f0c66b63ad4"
            },
            "request_params" : {},
            "request_method" : "POST"
        }
    }
}
This results in errors when exporting to the FS, because the file name has a `/` char in it. This needs to be escaped. From the request error log: ``` { "_id" : ObjectId("5f8d8ff8fd8dac3458c2bc87"), "timestamp" : ISODate("2020-10-19T13:09:12.288Z"), "request" : { "headers" : { "host" : "noded.garrettmills.dev", "accept-encoding" : "gzip", "cf-ipcountry" : "US", "x-forwarded-for" : "2001:48f8:9021:970:a496:cc45:379c:5b91, 108.162.216.243", "cf-ray" : "5e4abb6df86830aa-ORD", "x-forwarded-proto" : "https", "cf-visitor" : "{\"scheme\":\"https\"}", "user-agent" : "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0", "accept" : "application/json, text/plain, */*", "accept-language" : "en-US,en;q=0.5", "content-type" : "application/json", "origin" : "https://noded.garrettmills.dev", "dnt" : "1", "referer" : "https://noded.garrettmills.dev/i/editor;id=82a6783d-25b8-41c1-a384-31e8e9bb5306", "pragma" : "no-cache", "cache-control" : "no-cache", "cookie" : "...", "cf-request-id" : "05e29378c0000030aaa4bd6000000001", "cf-connecting-ip" : "2001:48f8:9021:970:a496:cc45:379c:5b91", "cdn-loop" : "cloudflare", "x-forwarded-host" : "noded.garrettmills.dev", "x-forwarded-server" : "noded.garrettmills.dev", "content-length" : "65", "connection" : "Keep-Alive" }, "url" : "/api/v1/exports/subtree", "method" : "POST", "baseUrl" : "", "originalUrl" : "/api/v1/exports/subtree", "params" : {}, "query" : {}, "body" : { "format" : "html", "PageId" : "a192c4e8-7633-46e0-a811-9f0c66b63ad4" }, "session_id" : "d86a8f1a-862d-402d-b118-a17bf82b8429", "files" : {} }, "is_auth" : true, "user_id" : "5f8c9f3cd9d4dd2fd69b3744", "additional_data" : {}, "response" : { "status_code" : 500, "message" : "ENOENT: no such file or directory, open '/tmp/tmp-13400-5rmaGToveFeg/export/Creamy-Lentils-w/-Kale-Artichoke-Saute-f9eb886e-71bc-4554-9a17-0ef1170ae571.html'", "data" : {} }, "error" : { "message" : "Error: ENOENT: no such file or directory, open '/tmp/tmp-13400-5rmaGToveFeg/export/Creamy-Lentils-w/-Kale-Artichoke-Saute-f9eb886e-71bc-4554-9a17-0ef1170ae571.html'", "stack" : [], "context" : { "request_path" : "/subtree", "request_query" : {}, "request_body" : { "format" : "html", "PageId" : "a192c4e8-7633-46e0-a811-9f0c66b63ad4" }, "request_params" : {}, "request_method" : "POST" } } } ```
garrettmills added the Bug Scope: Exports labels 4 years ago
garrettmills closed this issue 4 years ago
Sign in to join this conversation.
Loading…
There is no content yet.