Skip to content

Commit df75ecf

Browse files
committed
chore: fix runtime warnings
1 parent 789cd78 commit df75ecf

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/mimemail.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ defmodule MimeMail do
5353
escaped_bound = Regex.escape(bound)
5454
body
5555
|> String.split(~r"\s*--#{escaped_bound}\s*")
56-
|> Enum.slice(1..-2//-1)
56+
|> Enum.drop(1)
57+
|> Enum.drop(-1)
5758
|> Enum.map(&from_string/1)
5859
|> Enum.map(&decode_body/1)
5960
{"text/"<>_,%{charset: charset}} ->

lib/spf.ex

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,13 @@ defmodule SPF do
289289
delimiters = for <<c<-delimiters>>, c in [?.,?-,?+,?,,?/,?_,?=], into: "", do: <<c>>
290290
components=String.split(expanded,Regex.compile!("["<>delimiters<>"]"))
291291
components=if reversed?, do: Enum.reverse(components), else: components
292-
components=Enum.slice(components,max(-length(components),start_index)..-1)
292+
len = length(components)
293+
components =
294+
cond do
295+
start_index == 0 -> components
296+
len <= -start_index -> components
297+
true -> Enum.drop(components, len + start_index)
298+
end
293299
Enum.join(components,".")
294300
end
295301
end

0 commit comments

Comments
 (0)