Skip to content

Commit

Permalink
Allow absolute namespaces
Browse files Browse the repository at this point in the history
Add missing string template
Add missing EOF newline
  • Loading branch information
FlorianLebecque committed Feb 7, 2025
1 parent 7e3283c commit a453e31
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/core/Param.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default class Param {
get(callback, failedCallback) {
var paramClient = new Service({
ros: this.ros,
name: this.ros.namespace + 'rosapi/get_param',
name: `${this.ros.namespace}rosapi/get_param`,
serviceType: 'rosapi/GetParam'
});

Expand Down
4 changes: 2 additions & 2 deletions src/core/Ros.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ export default class Ros extends EventEmitter {
this.groovyCompatibility = options.groovyCompatibility ?? true;
this.namespace = options.namespace || '';

// Normalize namespace format: no leading slash, with trailing slash
// Normalize namespace format: with trailing slash
if (this.namespace) {
this.namespace = this.namespace.replace(/^\//, '').replace(/\/?$/, '/');
this.namespace = this.namespace.replace(/\/?$/, '/');
}

// begin by checking if a URL was given
Expand Down
2 changes: 1 addition & 1 deletion test/namespaces.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ describe('Namespaces', () => {
expect(topics).not.hasLength(0);
})

})
})

0 comments on commit a453e31

Please sign in to comment.