summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2020-02-10 18:28:30 +0300
committerrinpatch <rinpatch@sdf.org>2020-02-10 18:41:02 +0300
commitc55301e760a562ad9988911a8e2ae6b839794a08 (patch)
treee43851b87449dd9e4f424064c8ccfd4b19f01ade
parent544bdbfb90d764a5aba8ed07c13b842838d76d73 (diff)
Fix a compilation error under certain circumstances
I've noticed that sometimes when switching from develop to stable and back, develop fails to compile and rm -r ing the _build and deps dirs doesn't help at all. This is due to Admin API controller needing to generate JSON description of the config at compile time. Evaluating `config/description.exs` calls `Generator.list_modules_in_dir/2`, which in turn predicts the module names of files in the directory and tries to convert the predicted name to *existing* atoms. Sometimes the compiler will call that function before compiling the modules in the said directory, so the conversion will of course fail. This fixes it by removing the requirement of the atoms being existent. The function is not subjected to any untrusted user input so this should be safe. An ideal fix would be to block the compilation of docs before all modules are compiled and then get a list of compiled elixir modules under the namespace we want instead of directory hacks, but I have not been able to figure out how to do that.
-rw-r--r--lib/pleroma/docs/generator.ex2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/pleroma/docs/generator.ex b/lib/pleroma/docs/generator.ex
index 6b12dcdd9..e0fc8cd02 100644
--- a/lib/pleroma/docs/generator.ex
+++ b/lib/pleroma/docs/generator.ex
@@ -13,7 +13,7 @@ defmodule Pleroma.Docs.Generator do
|> Enum.filter(&String.ends_with?(&1, ".ex"))
|> Enum.map(fn filename ->
module = filename |> String.trim_trailing(".ex") |> Macro.camelize()
- String.to_existing_atom(start <> module)
+ String.to_atom(start <> module)
end)
end
end