From a84cdd3682327f783bea4e299186c1340ef93c0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Tue, 19 Aug 2025 17:45:53 +0200 Subject: [PATCH] Fixed: #2515 AS1/2 direct editation - getURL incorrect casing, generating ActionGetURL2 when not needed --- CHANGELOG.md | 2 ++ .../flash/action/model/GetURLActionItem.java | 13 +++++--- .../parser/script/ActionScript2Parser.java | 31 ++++++++++++++++--- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 310ed5e23..088818f83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,6 +67,7 @@ All notable changes to this project will be documented in this file. - [#2508] AS1/2 direct editation - first command in for loop header not compiled - [#2510] AS direct editation - popped value - [#2511] Allowing to search or to jump from search window while in editation mode +- [#2515] AS1/2 direct editation - getURL incorrect casing, generating ActionGetURL2 when not needed ### Changed - Icon of "Deobfuscation options" menu from pile of pills to medkit @@ -3977,6 +3978,7 @@ Major version of SWF to XML export changed to 2. [#2508]: https://www.free-decompiler.com/flash/issues/2508 [#2510]: https://www.free-decompiler.com/flash/issues/2510 [#2511]: https://www.free-decompiler.com/flash/issues/2511 +[#2515]: https://www.free-decompiler.com/flash/issues/2515 [#2476]: https://www.free-decompiler.com/flash/issues/2476 [#2404]: https://www.free-decompiler.com/flash/issues/2404 [#1418]: https://www.free-decompiler.com/flash/issues/1418 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/GetURLActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/GetURLActionItem.java index 696f99444..a3a77f057 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/GetURLActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/GetURLActionItem.java @@ -48,13 +48,18 @@ public class GetURLActionItem extends ActionItem { @Override public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) { - writer.append("getUrl"); + writer.append("getURL"); writer.spaceBeforeCallParenthesis(2); writer.append("(\""); writer.append(Helper.escapeActionScriptString(urlString)); - writer.append("\", \""); - writer.append(Helper.escapeActionScriptString(targetString)); - return writer.append("\")"); + writer.append("\""); + if (!targetString.isEmpty()) { + writer.append(", \""); + writer.append(Helper.escapeActionScriptString(targetString)); + writer.append("\""); + } + writer.append(")"); + return writer; } /** diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java index aa08cc97c..efeb8ddd0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java @@ -41,6 +41,7 @@ import com.jpexs.decompiler.flash.action.model.GetMemberActionItem; import com.jpexs.decompiler.flash.action.model.GetPropertyActionItem; import com.jpexs.decompiler.flash.action.model.GetTimeActionItem; import com.jpexs.decompiler.flash.action.model.GetURL2ActionItem; +import com.jpexs.decompiler.flash.action.model.GetURLActionItem; import com.jpexs.decompiler.flash.action.model.GetVariableActionItem; import com.jpexs.decompiler.flash.action.model.GetVersionActionItem; import com.jpexs.decompiler.flash.action.model.GotoFrame2ActionItem; @@ -659,10 +660,32 @@ public class ActionScript2Parser { case GETURL: expectedType(SymbolType.PARENT_OPEN); + s = lex(); + if (s.type == SymbolType.STRING) { + ParsedSymbol urlSymb = s; + s = lex(); + if (s.type == SymbolType.COMMA) { + ParsedSymbol targetSymb = lex(); + if (targetSymb.type == SymbolType.STRING) { + ParsedSymbol s2 = lex(); + if (s2.type == SymbolType.PARENT_CLOSE) { + ret = new GetURLActionItem(null, null, urlSymb.value.toString(), targetSymb.value.toString()); + break; + } + lexer.pushback(s2); + } + lexer.pushback(targetSymb); + } else if (s.type == SymbolType.PARENT_CLOSE) { + ret = new GetURLActionItem(null, null, urlSymb.value.toString(), ""); + break; + } + lexer.pushback(s); + lexer.pushback(urlSymb); + } GraphTargetItem url = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval)); s = lex(); expected(s, lexer.yyline(), SymbolType.PARENT_CLOSE, SymbolType.COMMA); - int getuMethod = 0; + int sendVarsMethod = 0; GraphTargetItem target; if (s.type == SymbolType.COMMA) { target = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval)); @@ -671,9 +694,9 @@ public class ActionScript2Parser { s = lex(); expected(s, lexer.yyline(), SymbolType.STRING); if (s.value.equals("GET")) { - getuMethod = 1; + sendVarsMethod = 1; } else if (s.value.equals("POST")) { - getuMethod = 2; + sendVarsMethod = 2; } else { throw new ActionParseException("Invalid method, \"GET\" or \"POST\" expected.", lexer.yyline()); } @@ -685,7 +708,7 @@ public class ActionScript2Parser { target = new DirectValueActionItem(null, null, 0, "", new ArrayList<>()); } expectedType(SymbolType.PARENT_CLOSE); - ret = new GetURL2ActionItem(null, null, url, target, getuMethod); + ret = new GetURL2ActionItem(null, null, url, target, sendVarsMethod); break; case GOTOANDSTOP: case GOTOANDPLAY: