Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v2.7.1 #6869

Merged
merged 10 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## \[2.7.1\] - 2023-09-15
### Fixed

- Include cloud storage manifest file to selected files if manifest was used as data source (<https://github.com/opencv/cvat/pull/6850>)
- Keep sequence of files when directories were specified in server_files (<https://github.com/opencv/cvat/pull/6850>)

## \[2.7.0\] - 2023-09-10
### Added

- Admin actions for easy activation/deactivation of users (<https://github.com/opencv/cvat/pull/6314>)

### Fixed

- Invalid input validation in for `cloud_storage_id` (<https://github.com/opencv/cvat/pull/6825>)
- Incorrect task progress report for 3rdparty users (<https://github.com/opencv/cvat/pull/6834>)

### Security

- Security upgrade gitpython from 3.1.33 to 3.1.35 (<https://github.com/opencv/cvat/pull/6843>)
- Security upgrade numpy from 1.22.0 to 1.22.4 (<https://github.com/opencv/cvat/pull/6843>)

Expand Down
8 changes: 7 additions & 1 deletion cvat-canvas/src/typescript/canvasView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,13 @@ export class CanvasViewImpl implements CanvasView, Listener {
}
if (e.altKey) {
const { points } = state;
this.onEditDone(state, points.slice(0, pointID * 2).concat(points.slice(pointID * 2 + 2)));
if (
(state.shapeType === 'polygon' && state.points.length > 6) ||
(state.shapeType === 'polyline' && state.points.length > 4) ||
(state.shapeType === 'points' && state.points.length > 2)
) {
this.onEditDone(state, points.slice(0, pointID * 2).concat(points.slice(pointID * 2 + 2)));
}
} else if (e.shiftKey) {
this.onEditStart(state);
this.editHandler.edit({
Expand Down
2 changes: 1 addition & 1 deletion cvat-cli/requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cvat-sdk~=2.7.0
cvat-sdk~=2.7.1
Pillow>=6.2.0
setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
2 changes: 1 addition & 1 deletion cvat-cli/src/cvat_cli/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "2.7.0"
VERSION = "2.7.1"
2 changes: 1 addition & 1 deletion cvat-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-core",
"version": "11.0.3",
"version": "11.1.0",
"description": "Part of Computer Vision Tool which presents an interface for client-side integration",
"main": "src/api.ts",
"scripts": {
Expand Down
3 changes: 1 addition & 2 deletions cvat-core/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import AnnotationGuide from './guide';
import * as enums from './enums';

import {
Exception, ArgumentError, DataError, ScriptingError, PluginError, ServerError,
Exception, ArgumentError, DataError, ScriptingError, ServerError,
} from './exceptions';

import User from './user';
Expand Down Expand Up @@ -249,7 +249,6 @@ function build() {
ArgumentError,
DataError,
ScriptingError,
PluginError,
ServerError,
},
cloudStorages: {
Expand Down
4 changes: 2 additions & 2 deletions cvat-core/src/download.worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ onmessage = (e) => {
.catch((error) => {
postMessage({
id: e.data.id,
status: error.response.status,
responseData: error.response.data,
message: error.message,
code: error.code,
isSuccess: false,
});
});
Expand Down
2 changes: 0 additions & 2 deletions cvat-core/src/exceptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ export class DataError extends Exception {}

export class ScriptingError extends Exception {}

export class PluginError extends Exception {}

export class ServerError extends Exception {
constructor(message, code) {
super(message);
Expand Down
43 changes: 18 additions & 25 deletions cvat-core/src/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
//
// SPDX-License-Identifier: MIT

import { PluginError } from './exceptions';
import { ArgumentError } from './exceptions';

const plugins = [];

export interface APIWrapperEnterOptions {
preventMethodCall?: boolean;
preventMethodCallWithReturn?: unknown;
}

export default class PluginRegistry {
Expand All @@ -21,39 +22,31 @@ export default class PluginRegistry {
for (const plugin of pluginList) {
const pluginDecorators = plugin.functions.filter((obj) => obj.callback === wrappedFunc)[0];
if (pluginDecorators && pluginDecorators.enter) {
try {
const options: APIWrapperEnterOptions | undefined = await pluginDecorators
.enter.call(this, plugin, ...args);
if (options?.preventMethodCall) {
aggregatedOptions.preventMethodCall = true;
const options: APIWrapperEnterOptions | undefined = await pluginDecorators
.enter.call(this, plugin, ...args);
if (options instanceof Object) {
if ('preventMethodCallWithReturn' in options) {
aggregatedOptions.preventMethodCallWithReturn = options.preventMethodCallWithReturn;
}
} catch (exception) {
if (exception instanceof PluginError) {
throw exception;
} else {
throw new PluginError(`Exception in plugin ${plugin.name}: ${exception.toString()}`);

if ('preventMethodCall' in options) {
aggregatedOptions.preventMethodCall = true;
}
}
}
}

let result = null;
if (!aggregatedOptions.preventMethodCall) {
if ('preventMethodCallWithReturn' in aggregatedOptions) {
result = aggregatedOptions.preventMethodCallWithReturn;
} else if (!aggregatedOptions.preventMethodCall) {
result = await wrappedFunc.implementation.call(this, ...args);
}

for (const plugin of pluginList) {
const pluginDecorators = plugin.functions.filter((obj) => obj.callback === wrappedFunc)[0];
if (pluginDecorators && pluginDecorators.leave) {
try {
result = await pluginDecorators.leave.call(this, plugin, result, ...args);
} catch (exception) {
if (exception instanceof PluginError) {
throw exception;
} else {
throw new PluginError(`Exception in plugin ${plugin.name}: ${exception.toString()}`);
}
}
result = await pluginDecorators.leave.call(this, plugin, result, ...args);
}
}

Expand All @@ -65,19 +58,19 @@ export default class PluginRegistry {
const functions = [];

if (typeof plug !== 'object') {
throw new PluginError(`Plugin should be an object, but got "${typeof plug}"`);
throw new ArgumentError(`Plugin should be an object, but got "${typeof plug}"`);
}

if (!('name' in plug) || typeof plug.name !== 'string') {
throw new PluginError('Plugin must contain a "name" field and it must be a string');
throw new ArgumentError('Plugin must contain a "name" field and it must be a string');
}

if (!('description' in plug) || typeof plug.description !== 'string') {
throw new PluginError('Plugin must contain a "description" field and it must be a string');
throw new ArgumentError('Plugin must contain a "description" field and it must be a string');
}

if ('functions' in plug) {
throw new PluginError('Plugin must not contain a "functions" field');
throw new ArgumentError('Plugin must not contain a "functions" field');
}

function traverse(plugin, api) {
Expand Down
41 changes: 13 additions & 28 deletions cvat-core/src/server-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,26 +197,20 @@ class WorkerWrappedAxios {

worker.onmessage = (e) => {
if (e.data.id in requests) {
if (e.data.isSuccess) {
requests[e.data.id].resolve(e.data.responseData);
} else {
requests[e.data.id].reject({
response: {
status: e.data.status,
data: e.data.responseData,
},
});
try {
if (e.data.isSuccess) {
requests[e.data.id].resolve(e.data.responseData);
} else {
requests[e.data.id].reject(new AxiosError(e.data.message, e.data.code));
}
} finally {
delete requests[e.data.id];
}

delete requests[e.data.id];
}
};

worker.onerror = (e) => {
if (e.data.id in requests) {
requests[e.data.id].reject(e);
delete requests[e.data.id];
}
worker.onerror = () => {
throw new Error('Unexpected download worker error');
};

function getRequestId(): number {
Expand All @@ -226,10 +220,7 @@ class WorkerWrappedAxios {
async function get(url: string, requestConfig) {
return new Promise((resolve, reject) => {
const newRequestId = getRequestId();
requests[newRequestId] = {
resolve,
reject,
};
requests[newRequestId] = { resolve, reject };
worker.postMessage({
url,
config: requestConfig,
Expand Down Expand Up @@ -1508,7 +1499,7 @@ async function getData(jid: number, chunk: number, quality: ChunkQuality): Promi
const { backendAPI } = config;

try {
const response = await workerAxios.get(`${backendAPI}/jobs/${jid}/data`, {
const response = await (workerAxios as any).get(`${backendAPI}/jobs/${jid}/data`, {
params: {
...enableOrganization(),
quality,
Expand All @@ -1520,13 +1511,7 @@ async function getData(jid: number, chunk: number, quality: ChunkQuality): Promi

return response;
} catch (errorData) {
throw generateError({
message: '',
response: {
...errorData.response,
data: String.fromCharCode.apply(null, new Uint8Array(errorData.response.data)),
},
});
throw generateError(errorData);
}
}

Expand Down
26 changes: 14 additions & 12 deletions cvat-data/src/ts/cvat-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,20 @@ export function decodeContextImages(
const result: Record<string, ImageBitmap> = {};
let decoded = 0;

decodeZipWorker.onerror = (e: ErrorEvent) => {
decodeZipWorker.onerror = (event: ErrorEvent) => {
release();
reject(new Error(`Archive can not be decoded. ${e.message}`));
reject(event.error);
};

decodeZipWorker.onmessage = async (event) => {
const { error, fileName } = event.data;
if (error) {
decodeZipWorker.onerror(new ErrorEvent('error', { message: error.toString() }));
if (event.data.error) {
this.zipWorker.onerror(new ErrorEvent('error', {
error: event.data.error,
}));
return;
}

const { data } = event.data;
const { data, fileName } = event.data;
result[fileName.split('.')[0]] = data;
decoded++;

Expand Down Expand Up @@ -253,10 +254,10 @@ export class FrameDecoder {
index++;
};

worker.onerror = () => {
worker.onerror = (event: ErrorEvent) => {
release();
worker.terminate();
this.chunkIsBeingDecoded.onReject(new Error('Error occured during decode'));
this.chunkIsBeingDecoded.onReject(event.error);
this.chunkIsBeingDecoded = null;
};

Expand Down Expand Up @@ -290,7 +291,9 @@ export class FrameDecoder {

this.zipWorker.onmessage = async (event) => {
if (event.data.error) {
this.zipWorker.onerror(new ErrorEvent('error', { message: event.data.error.toString() }));
this.zipWorker.onerror(new ErrorEvent('error', {
error: event.data.error,
}));
return;
}

Expand All @@ -306,10 +309,9 @@ export class FrameDecoder {
index++;
};

this.zipWorker.onerror = () => {
this.zipWorker.onerror = (event: ErrorEvent) => {
release();

this.chunkIsBeingDecoded.onReject(new Error('Error occured during decode'));
this.chunkIsBeingDecoded.onReject(event.error);
this.chunkIsBeingDecoded = null;
};

Expand Down
Loading