package com.atlassian.stash.internal.rest.avatar;

import com.atlassian.plugins.rest.common.multipart.MultipartConfig;

/**
 * Ideally, this should look up the configuration somehow. It's not simple with how Atlassian REST uses this, however,
 * so since it's a low value for the moment the limitations are hard-coded.
 * <p>
 * Note: The SpringMVC controllers also allow uploading avatars, and they honour the configurable limits. So as a
 * workaround for the moment, if oversized avatars are desired, they can be uploaded via SpringMVC.
 *
 * @since 2.1
 */
public class AvatarMultipartConfig implements MultipartConfig {

    private static final long ONE_MEGABYTE = 1024 * 1024;

    @Override
    public long getMaxFileSize() {
        return ONE_MEGABYTE;
    }

    @Override
    public long getMaxSize() {
        return -1L;
    }
}
