Skip to content

Commit

Permalink
Merge pull request #11152 from keymanapp/fix/windows/11005/decode-uri…
Browse files Browse the repository at this point in the history
…-packageid

fix(windows): decode uri for Package ID and filename
  • Loading branch information
rc-swag authored Apr 5, 2024
2 parents 4dd3672 + fdc1db4 commit d711856
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 7 deletions.
3 changes: 2 additions & 1 deletion common/windows/delphi/general/Upload_Settings.pas
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ implementation
DebugPaths,
ErrorControlledRegistry,
RegistryKeys,
utilhttp,
VersionInfo;

const
Expand Down Expand Up @@ -169,7 +170,7 @@ function URLPath_PackageDownload(const PackageID, BCP47: string; IsUpdate: Boole
begin
if IsUpdate then IsUpdateInt := 1 else IsUpdateInt := 0;

Result := Format(URLPath_PackageDownload_Format, [PackageID, CKeymanVersionInfo.Tier, BCP47, IsUpdateInt]);
Result := Format(URLPath_PackageDownload_Format, [URLEncode(PackageID), URLEncode(CKeymanVersionInfo.Tier), URLEncode(BCP47), IsUpdateInt]);
end;

end.
3 changes: 2 additions & 1 deletion developer/src/kmconvert/kmconvert.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ uses
Keyman.System.LexicalModelUtils in '..\common\delphi\lexicalmodels\Keyman.System.LexicalModelUtils.pas',
KeymanDeveloperOptions in '..\tike\main\KeymanDeveloperOptions.pas',
Keyman.Developer.System.KeymanDeveloperPaths in '..\tike\main\Keyman.Developer.System.KeymanDeveloperPaths.pas',
Keyman.Developer.System.LdmlKeyboardProjectTemplate in 'Keyman.Developer.System.LdmlKeyboardProjectTemplate.pas';
Keyman.Developer.System.LdmlKeyboardProjectTemplate in 'Keyman.Developer.System.LdmlKeyboardProjectTemplate.pas',
utilhttp in '..\..\..\common\windows\delphi\general\utilhttp.pas';

{$R icons.RES}
{$R version.res}
Expand Down
1 change: 1 addition & 0 deletions developer/src/kmconvert/kmconvert.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
<DCCReference Include="..\tike\main\KeymanDeveloperOptions.pas"/>
<DCCReference Include="..\tike\main\Keyman.Developer.System.KeymanDeveloperPaths.pas"/>
<DCCReference Include="Keyman.Developer.System.LdmlKeyboardProjectTemplate.pas"/>
<DCCReference Include="..\..\..\common\windows\delphi\general\utilhttp.pas"/>
<BuildConfiguration Include="Release">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
Expand Down
3 changes: 2 additions & 1 deletion developer/src/setup/setup.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ uses
utilexecute in '..\..\..\common\windows\delphi\general\utilexecute.pas',
KeymanVersion in '..\..\..\common\windows\delphi\general\KeymanVersion.pas',
SFX in '..\..\..\common\windows\delphi\setup\SFX.pas',
Keyman.System.UpdateCheckResponse in '..\..\..\common\windows\delphi\general\Keyman.System.UpdateCheckResponse.pas';
Keyman.System.UpdateCheckResponse in '..\..\..\common\windows\delphi\general\Keyman.System.UpdateCheckResponse.pas',
utilhttp in '..\..\..\common\windows\delphi\general\utilhttp.pas';

{$R icons.res}
{$R version.res}
Expand Down
1 change: 1 addition & 0 deletions developer/src/setup/setup.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
<DCCReference Include="..\..\..\common\windows\delphi\general\KeymanVersion.pas"/>
<DCCReference Include="..\..\..\common\windows\delphi\setup\SFX.pas"/>
<DCCReference Include="..\..\..\common\windows\delphi\general\Keyman.System.UpdateCheckResponse.pas"/>
<DCCReference Include="..\..\..\common\windows\delphi\general\utilhttp.pas"/>
<BuildConfiguration Include="Debug">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ implementation
UfrmInstallKeyboard,
Upload_Settings,
utildir,
utilhttp,
utilfiletypes;

{ TKeymanProtocolHandler }
Expand Down Expand Up @@ -74,9 +75,9 @@ function TKeymanProtocolHandler.DoHandle(Owner: TComponent;
if not m.Success then
Exit(False);

PackageID := m.Groups[1].Value;
PackageID := URLDecode(m.Groups[1].Value);
if m.Groups.Count > 2
then BCP47 := m.Groups[2].Value
then BCP47 := URLDecode(m.Groups[2].Value)
else BCP47 := '';

// Download the package
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ implementation
Upload_Settings,
utilfiletypes,
utildir,
utilhttp,
utilexecute,
VersionInfo;

Expand Down Expand Up @@ -190,7 +191,7 @@ procedure TfrmInstallKeyboardFromWeb.cefBeforeBrowseEx(Sender: TObject; const Ur
if m.Success then
begin
// We want to install the keyboard found in the path.
PackageID := m.Groups[1].Value;
PackageID := URLDecode(m.Groups[1].Value);
uri := TURI.Create(url);

try
Expand Down
3 changes: 2 additions & 1 deletion windows/src/desktop/setup/setup.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ uses
Keyman.System.MITLicense in '..\..\global\delphi\general\Keyman.System.MITLicense.pas',
Keyman.Setup.System.Locales in 'Keyman.Setup.System.Locales.pas',
Keyman.System.UILanguageManager in '..\..\global\delphi\general\Keyman.System.UILanguageManager.pas',
Keyman.Setup.System.SetupUILanguageManager in 'Keyman.Setup.System.SetupUILanguageManager.pas';
Keyman.Setup.System.SetupUILanguageManager in 'Keyman.Setup.System.SetupUILanguageManager.pas',
utilhttp in '..\..\..\..\common\windows\delphi\general\utilhttp.pas';

{$R icons.res}
{$R version.res}
Expand Down
1 change: 1 addition & 0 deletions windows/src/desktop/setup/setup.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
<DCCReference Include="Keyman.Setup.System.Locales.pas"/>
<DCCReference Include="..\..\global\delphi\general\Keyman.System.UILanguageManager.pas"/>
<DCCReference Include="Keyman.Setup.System.SetupUILanguageManager.pas"/>
<DCCReference Include="..\..\..\..\common\windows\delphi\general\utilhttp.pas"/>
<BuildConfiguration Include="Debug">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
Expand Down

0 comments on commit d711856

Please sign in to comment.