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

fix: fixed null content type issue #55

Merged
merged 5 commits into from
Mar 28, 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
7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## v1.3.2

### March 28, 2024

- Fix:
- fixed null content type issue

## v1.3.1

### Feb 22, 2024
Expand Down
8 changes: 6 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<artifactId>cms</artifactId>
<packaging>jar</packaging>
<name>contentstack-management-java</name>
<version>1.3.1</version>
<version>1.3.2</version>
<description>Contentstack Java Management SDK for Content Management API, Contentstack is a headless CMS with an
API-first approach
</description>
Expand Down Expand Up @@ -177,7 +177,11 @@
<version>1.1.1</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>


Expand Down
8 changes: 6 additions & 2 deletions src/main/java/com/contentstack/cms/stack/FileUploader.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Objects;

import javax.activation.MimetypesFileTypeMap;

public class FileUploader {


Expand Down Expand Up @@ -49,7 +51,9 @@ private void addFormDataPartIfNotNull(MultipartBody.Builder builder, String name
// Helper method to get content type of file
private String getContentType(File file) {
try {
return Files.probeContentType(file.toPath());
java.nio.file.Path source = Paths.get(file.toString());
MimetypesFileTypeMap m = new MimetypesFileTypeMap(source.toString());
return m.getContentType(file);
} catch (IOException e) {
throw new RuntimeException("Failed to determine content type of file", e);
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/contentstack/cms/stack/Merge.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* @author ishaileshmishra
* @version v1.0.0
* @see <a href=
* "https://stag-www.contentstack.com/docs/developers/apis/content-management-api/#merge-branches">Merge
* "https://www.contentstack.com/docs/developers/apis/content-management-api/#merge-branches">Merge
* Branches </a>
* @since 2023 -June-30
*/
Expand Down Expand Up @@ -128,7 +128,7 @@ public Call<ResponseBody> branch(@NotNull String compareBranch, JSONObject reque
*
* @return the call
* @see <a href=
* "https://stag-www.contentstack.com/docs/developers/apis/content-management-api/#get-all-merge-jobs"></a>Get
* "https://www.contentstack.com/docs/developers/apis/content-management-api/#get-all-merge-jobs"></a>Get
* all
* Merge Jobs
*/
Expand All @@ -144,7 +144,7 @@ public Call<ResponseBody> find() {
* @param mergeJobUid the key of the header to be added
* @return the call
* @see <a href=
* "https://stag-www.contentstack.com/docs/developers/apis/content-management-api/#get-single-merge-job"></a>Get
* "https://www.contentstack.com/docs/developers/apis/content-management-api/#get-single-merge-job"></a>Get
* a
* Single Merge Job
*/
Expand Down
Loading