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

Add New Capabilities For Compatible File Names #1494

Merged
merged 8 commits into from
Aug 23, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ public class GetCapabilitiesRemoteOperation extends RemoteOperation {
private static final String NODE_SECURITY_GUARD = "security_guard";
private static final String NODE_DIAGNOSTICS = "diagnostics";

// needed for checking compatible filenames
private static final String FORBIDDEN_FILENAME_CHARACTERS = "forbidden_filename_characters";
private static final String FORBIDDEN_FILENAMES = "forbidden_filenames";
private static final String FORBIDDEN_FILENAME_EXTENSIONS = "forbidden_filename_extensions";
private static final String FORBIDDEN_FILENAME_BASE_NAMES = "forbidden_filename_basenames";

private OCCapability currentCapability = null;

public GetCapabilitiesRemoteOperation() {
Expand Down Expand Up @@ -438,6 +444,28 @@ private OCCapability parseResponse(String response) throws JSONException {
capability.setDirectEditingEtag(respDirectEditing.getString("etag"));
}

// region compatible file names
if (respFiles.has(FORBIDDEN_FILENAME_CHARACTERS)) {
JSONArray result = respFiles.getJSONArray(FORBIDDEN_FILENAME_CHARACTERS);
capability.setForbiddenFilenameCharactersJson(result.toString());
}

if (respFiles.has(FORBIDDEN_FILENAMES)) {
JSONArray result = respFiles.getJSONArray(FORBIDDEN_FILENAMES);
capability.setForbiddenFilenamesJson(result.toString());
}

if (respFiles.has(FORBIDDEN_FILENAME_EXTENSIONS)) {
JSONArray result = respFiles.getJSONArray(FORBIDDEN_FILENAME_EXTENSIONS);
capability.setForbiddenFilenameExtensionJson(result.toString());
}

if (respFiles.has(FORBIDDEN_FILENAME_BASE_NAMES)) {
JSONArray result = respFiles.getJSONArray(FORBIDDEN_FILENAME_BASE_NAMES);
capability.setForbiddenFilenameBaseNamesJson(result.toString());
}
// endregion

Log_OC.d(TAG, "*** Added " + NODE_FILES);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ class OCCapability {
// Security guard
var securityGuard = CapabilityBooleanType.UNKNOWN

// needed for checking compatible filenames
var forbiddenFilenameCharactersJson: String? = null
var forbiddenFilenamesJson: String? = null
var forbiddenFilenameExtensionJson: String? = null
var forbiddenFilenameBaseNamesJson: String? = null

// Etag for capabilities
var etag: String? = ""

Expand Down
Loading