<commit_before>package imcode.server.document.textdocument;

import imcode.server.Imcms;
import imcode.server.ImcmsServices;
import imcode.util.io.FileInputStreamSource;
import imcode.util.io.FileUtility;
import imcode.util.io.InputStreamSource;

import java.io.File;
import java.util.Date;

public class ImagesPathRelativePathImageSource extends ImageSource {
    private String relativePath;

    public ImagesPathRelativePathImageSource( String relativePath ) {
        this.relativePath = relativePath;
    }

    public InputStreamSource getInputStreamSource( ) {
        return new FileInputStreamSource( getFile( ) );
    }

    private File getFile( ) {
        ImcmsServices service = Imcms.getServices( );
        File imageDirectory = service.getConfig( ).getImagePath( );
        File imageFile = new File( imageDirectory, relativePath );
        return imageFile;
    }

    public String getUrlPathRelativeToContextPath( ) {
        File file = new File ( relativePath );
        return Imcms.getServices( ).getConfig( ).getImageUrl( ) + FileUtility.relativeFileToString( file );

    }

    public String toStorageString( ) {
        return relativePath;
    }

    public int getTypeId( ) {<commit_msg>Issue 3339: Replace backslashes with forwardslashes in image-paths.<commit_after>package imcode.server.document.textdocument;

import imcode.server.Imcms;
import imcode.server.ImcmsServices;
import imcode.util.io.FileInputStreamSource;
import imcode.util.io.FileUtility;
import imcode.util.io.InputStreamSource;

import java.io.File;
import java.util.Date;

public class ImagesPathRelativePathImageSource extends ImageSource {
    private String relativePath;

    public ImagesPathRelativePathImageSource( String relativePath ) {
        this.relativePath = relativePath.replace('\\','/');
    }

    public InputStreamSource getInputStreamSource( ) {
        return new FileInputStreamSource( getFile( ) );
    }

    private File getFile( ) {
        ImcmsServices service = Imcms.getServices( );
        File imageDirectory = service.getConfig( ).getImagePath( );
        File imageFile = new File( imageDirectory, relativePath );
        return imageFile;
    }

    public String getUrlPathRelativeToContextPath( ) {
        File file = new File ( relativePath );
        return Imcms.getServices( ).getConfig( ).getImageUrl( ) + FileUtility.relativeFileToString( file );

    }

    public String toStorageString( ) {
        return relativePath;
    }

    public int getTypeId( ) {
{'fraction_non_alphanumeric': 0.08692185007974482, 'fraction_numerical': 0.001594896331738437, 'mean_word_length': 3.5784671532846715, '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': '4445583', 'n_tokens_mistral': 695, 'n_tokens_neox': 669, 'n_words': 161}