Fork me on GitHub
#clojure
<
2019-05-25
>
datran02:05:10

So here's a surprising thing I just found: (java.net.URI. "https://google.com") actually fetches the page

datran02:05:46

The javadoc didn't mention that, as far as I can tell.

datran02:05:36

Also, it seems to throw up on localhost uris. Is there a good way to validate uris without fetching?

potetm02:05:10

@datran Why do you think (URI. "") makes a network call?

datran02:05:02

because it dumped the response in my repl

datran02:05:51

does it not do that for you?

potetm02:05:14

for me:

(java.net.URI. "")
=> #object[java.net.URI 0x7abeb19d ""]

dpsutton02:05:28

This is a bad cider feature unfortunately

dpsutton02:05:52

It can be disabled and should be by default. This is the feature to show images in the repl.

datran02:05:22

thanks πŸ˜„

datran02:05:32

Do you know what the feature is called, that I may disable it?

dpsutton03:05:09

i think you want (setq cider-repl-use-content-types nil)

cfleming05:05:25

I was surprised to find that form metadata doesn’t contain :file by default for quoted forms, only :line and :column - I thought it did.

cfleming05:05:16

Reading the source, it looks like this is because :file metadata is added by the compiler, not the reader - is that correct? Is there any trickery I can use to get the file from quoted forms?

cfleming05:05:54

Actually, no, it looks like :file is only added for vars in the compiler. I guess this is because the reader is reading from Reader, not necessarily a file.

alexmiller12:05:02

Sounds right

georgiana.mania13:05:02

[clojure deps question] in an Ubuntu env, I can run git clone [email protected]:my-workspace/my-project and it runs fine using the SSH keys, but when this project is added as dependency for other project like my-project {:git/url "[email protected]:my-workspace/my-project" :sha "0123..."} I get an error:

Cloning: [email protected]:my-workspace/my-project
Error building classpath. connector is not available: 
com.jcraft.jsch.agentproxy.AgentProxyException: connector is not available
Am I missing a configuration somewhere? πŸ™‚

dorab17:05:30

@georgiana.mania Have you looked at the Git configuration section of https://clojure.org/reference/deps_and_cli Perhaps that can help.

georgiana.mania17:05:29

thanks @dorab! I just fixed it. it was an issue with ssh-agent on that machine.

dorab17:05:24

Great. Glad it is resolved.

plins18:05:12

hey everyone, is there an easy way to load edn files with env vars attached to specific lein tasks? lein test would load test-config.edn while lein run would load dev-config.edn

vemv19:05:14

sounds like an "xy" problem tbh... are you using Component/Integrant in the first place? They make it straightforward to have per-env systems, with different configs

plins21:05:17

Ill take a llok into component thx πŸ˜ƒ

worlds-endless20:05:37

Using reitit, I have an html file in my resources/public that I wish to serve as my root "/". With the following code it serves it, but does so with a 302 redirect to /index.html. How can I just straight up serve without the redirect? Why is it redirecting at all? (response/file-response (str (io/resource "public/index.html")))

worlds-endless20:05:19

^ (response is ring.util.response)

slack103820:05:45

why not using resource-response ?

worlds-endless20:05:06

Thanks; that does the trick! Still not sure why the file-response was resulting in a redirect, though

worlds-endless20:05:31

Oops; actually, doesn't work, because it tries to download as an octet stream when I hit it with a browser

slack103820:05:52

you could read the file as a string and respond with it in the body and content type set to text/html

worlds-endless20:05:44

Yeah, I figured that would be a last resort

worlds-endless20:05:12

Hmmmm.... I'll try that; I didn't know about it