<commit_before>package com.jonasgerdes.schauburgr.network.image;

import com.jonasgerdes.schauburgr.model.Movie;

/**
 * Created by jonas on 07.03.2017.
 */

public class SchauburgImageUrlCreator implements ImageUrlCreator {

    private String mBaseUrl;

    public SchauburgImageUrlCreator(String baseUrl) {
        mBaseUrl = baseUrl;
    }

    @Override
    public String getPosterImageUrl(Movie movie) {
        return mBaseUrl + "generated/" + movie.getResourceId() + ".jpg";
    }
}<commit_msg>Fix wrong posters beeing displayed<commit_after>package com.jonasgerdes.schauburgr.network.image;

import android.util.Base64;

import com.jonasgerdes.schauburgr.model.Movie;

/**
 * Created by jonas on 07.03.2017.
 */

public class SchauburgImageUrlCreator implements ImageUrlCreator {

    private String mBaseUrl;

    public SchauburgImageUrlCreator(String baseUrl) {
        mBaseUrl = baseUrl;
    }

    @Override
    public String getPosterImageUrl(Movie movie) {
        //Encode title as Base64 and append it to url to prevent issue when same image is used for
        //different movie while still allowing image to be cached as long as used for same movie
        byte[] titleBytes = movie.getTitle().getBytes();
        String fingerprint = Base64.encodeToString(titleBytes, Base64.URL_SAFE | Base64.NO_PADDING);
        return mBaseUrl + "generated/" + movie.getResourceId() + ".jpg?f=" + fingerprint;
    }
}
{'fraction_non_alphanumeric': 0.08912280701754385, 'fraction_numerical': 0.018245614035087718, 'mean_word_length': 3.5414012738853504, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1378012', 'n_tokens_mistral': 467, 'n_tokens_neox': 428, 'n_words': 113}