Skip to content

Commit

Permalink
Regression: Fix invalid version string error on marketplace screen (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
d-gubert authored and sampaiodiego committed Sep 25, 2019
1 parent abf7426 commit a9b8fba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions app/apps/server/communication/rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import { Info } from '../../../utils';
import { Settings, Users } from '../../../models/server';
import { Apps } from '../orchestrator';

const appsEngineVersionForMarketplace = Info.marketplaceApiVersion.replace(/-.*/g, '');
const getDefaultHeaders = () => ({
'X-Apps-Engine-Version': Info.marketplaceApiVersion,
'X-Apps-Engine-Version': appsEngineVersionForMarketplace,
});

const purchaseTypes = new Set(['buy', 'subscription']);
Expand Down Expand Up @@ -341,7 +342,7 @@ export class AppsRestApi {

let result;
try {
result = HTTP.get(`${ baseUrl }/v1/apps/${ this.urlParams.id }/latest?frameworkVersion=${ Info.marketplaceApiVersion }`, {
result = HTTP.get(`${ baseUrl }/v1/apps/${ this.urlParams.id }/latest?frameworkVersion=${ appsEngineVersionForMarketplace }`, {
headers,
});
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-version/plugin/compile-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class VersionCompiler {
}

const pkg = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf8'));
output.marketplaceApiVersion = pkg.dependencies['@rocket.chat/apps-engine'].replace(/[^0-9.]/g, '');
output.marketplaceApiVersion = pkg.dependencies['@rocket.chat/apps-engine'].replace(/^[^0-9]/g, '');

output = `exports.Info = ${ JSON.stringify(output, null, 4) };`;
file.addJavaScript({
Expand Down

0 comments on commit a9b8fba

Please sign in to comment.