File tree Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -2684,17 +2684,7 @@ defmodule AshPhoenix.Form do
2684
2684
def get_form ( form , path ) do
2685
2685
form = to_form! ( form )
2686
2686
2687
- path =
2688
- case path do
2689
- [ ] ->
2690
- [ ]
2691
-
2692
- path when is_list ( path ) ->
2693
- path
2694
-
2695
- path ->
2696
- parse_path! ( form , path )
2697
- end
2687
+ path = parse_path! ( form , path )
2698
2688
2699
2689
case path do
2700
2690
[ ] ->
@@ -2724,6 +2714,9 @@ defmodule AshPhoenix.Form do
2724
2714
nil
2725
2715
end
2726
2716
end
2717
+ rescue
2718
+ InvalidPath ->
2719
+ nil
2727
2720
end
2728
2721
2729
2722
defp to_form! ( % __MODULE__ { } = form ) , do: form
@@ -4643,7 +4636,19 @@ defmodule AshPhoenix.Form do
4643
4636
4644
4637
{ path , last } =
4645
4638
if opts [ :skip_last? ] do
4646
- { :lists . droplast ( path ) , List . last ( path ) }
4639
+ last = List . last ( path )
4640
+
4641
+ if is_binary ( last ) do
4642
+ case Integer . parse ( last ) do
4643
+ { int , "" } ->
4644
+ { :lists . droplast ( path ) , int }
4645
+
4646
+ _ ->
4647
+ { :lists . droplast ( path ) , last }
4648
+ end
4649
+ else
4650
+ { :lists . droplast ( path ) , last }
4651
+ end
4647
4652
else
4648
4653
{ path , nil }
4649
4654
end
You can’t perform that action at this time.
0 commit comments