Skip to content

Commit

Permalink
aas-server bug fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfaron committed Nov 9, 2023
1 parent b1d5429 commit c8c11e1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
6 changes: 1 addition & 5 deletions projects/aas-server/src/app/aas-provider/aas-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ export class AASProvider {
this.startContainerScan,
this.timeout,
result.taskId,
{ name: task.id, container: endpoint, documents },
{ ...endpoint, documents },
result.statistic);
}).catch(error => this.logger.error(error));
}
Expand Down Expand Up @@ -592,10 +592,6 @@ export class AASProvider {
// return document;
// }

private getUrl(url: string): string {
return url.split('?')[0];
}

private createTaskId(): number {
const taskId = this.nextTaskId;
++this.nextTaskId;
Expand Down
10 changes: 9 additions & 1 deletion projects/aas-server/src/app/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,15 @@ export function createEndpoint(url: string, name: string, type: AASEndpointType
return { url, name, type, version };
}

/**
* Creates an AASEndpoint form an URL.
* @param url The current URL.
* @returns An equivalent AASEndpoint.
*/
export function urlToEndpoint(url: string): AASEndpoint {
const value = new URL(url);
const name = value.searchParams.get('name');
const type = value.searchParams.get('type') as AASEndpointType ?? 'AasxServer';
const type = value.searchParams.get('type') as AASEndpointType ?? getEndpointType(value);
const version = value.searchParams.get('version') ?? '3.0';

value.search = '';
Expand All @@ -71,6 +76,9 @@ export function urlToEndpoint(url: string): AASEndpoint {
return { url: value.href, name: name ?? value.href, type, version };
}

/**
* Creates an URL that represents an AASEndpoint.
*/
export function endpointUrl(url: string, name: string, type: AASEndpointType, version?: string): URL {
const value = new URL(url);
value.searchParams.append('name', name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,12 @@ export class AasxServerPackage extends AASPackage {
}

private async createThumbnail(id: string): Promise<string | undefined> {
const input = await this.source.getThumbnailAsync(id);
const output = await ImageProcessing.resizeAsync(input, 40, 40);
return await this.streamToBase64(output);
try {
const input = await this.source.getThumbnailAsync(id);
const output = await ImageProcessing.resizeAsync(input, 40, 40);
return await this.streamToBase64(output);
} catch {
return undefined;
}
}
}

0 comments on commit c8c11e1

Please sign in to comment.