How can I sanitize a string for use as a filename?

I've got a routine that converts a file into a different format and saves it. The original datafiles were numbered, but my routine gives the output a filename based on an internal name found in...

string sanitizer for filename

I'm looking for a php function that will sanitize a string and make it ready to use for a filename. Anyone know of a handy one? ( I could write one, but I'm worried that I'll overlook a character!...

Python error: TypeError: 'module' object is not callable for HeadFirst Python code

I'm following the tutorial from the HeadFirst Python book. In chapter 7, I get an error message when trying to run the next code: Athlete class: class AthleteList(list): def __init__(self,...

Remove all dots in filename except the dot before the file extension

I am trying to sanitize a filename. I would like to know of a way to remove all decimals from a files name except the last one. I need to keep the last one because the extension follows...

escaping special characters using sqlalchemy

I'm storing filenames and filepaths in mySQL. Retrieving them from the database using the LIKE expression requires that I escape all allowed filename chars that collide with mysql special chars. ...

Add the "picture-" suffix to all images when uploading to Wordpress

I'm using this in my WordPress theme functions.php to sanitize all images filenames when uploaded: function sa_sanitize_special_chars ($filename) { return remove_accents( $filename...

str.translate gives TypeError - Translate takes one argument (2 given), worked in Python 2

I have the following code import nltk, os, json, csv, string, cPickle from scipy.stats import scoreatpercentile lmtzr = nltk.stem.wordnet.WordNetLemmatizer() def sanitize(wordList): answer =...

how to retrieve a html brake from mysql

first of all I found some topics about this on this forum but just can't seem to get it right on my page... so that's why I'm asking. I am trying to make a image upload script for a webpage that...

Webpack Dev Server: Unknown argument: NODE_ENV

I have setup my angular js project with webpack. I am getting below error whenever I try to run in development mode: "Unknown argument: NODE_ENV". Below is my package.json. I am already using...

Bash sanitize_file_name function

I'm attempting to find a way to sanitize/filter file names in a Bash script the exact same way as the sanitize_file_name function from WordPress works. It has to take a filename string and spit...

AttributeError: 'tuple' object has no attribute 'encode' python

I wrote a program that sends an email with results using the python smtp library: def send_mail(sender_mail, receiver_mail): msg = MIMEMultipart() msg['From'] = sender_mail msg['To'] =...

How to get data attribute for div item on another page

I am using slim image cropper. I have the following. <div class="slim" data-service="async.php" data-ratio="3:2" data-size="600,400" data-row=""> <!-- <input type="hidden" id="rowID"...

How do I identify which npm packages are just peer dependencies?

I'm trying to remove unused packages from the package.json files for a few projects but I'm running into issues with peer dependencies. There are some tools, such as depcheck, which try to list...

React Redux with SSR vs IE11 - The client app don't start

We have built an App in React-Redux with SSR. It works wonderfully on every browsers except Internet Explorer 11 and bellow. The app is rendered on server side and display on client browser, but...

Prevent an HTTP Response Splitting attack in Java

I am using spring controller where I have method get to download file. controller method is used to download file and I am setting file name as this.. response.setHeader("Content-disposition",...

Webpack build Angular.js - Failed to instantiate module app

I am trying to move our angular.js builds from gulp to webpack. I already did a successful bundle with vendor libs but I am getting the problems with angular.js modules. Uncaught Error:...

Image upload with sonata admin

See EDIT above I think the issue is pretty simple to solve but I can't find any clear answer right now. I hope you might have an idea. I'm trying to upload an image with sonata admin. In my entity...

Webpack in watch mode takes too long to build (~23s) after changes

After saving changes, webpack takes on average ~23 seconds to build. This is the output while it is building. It goes all the way up to 6695 modules before completing. 18% building 915/944 modules...

Flask - Do I need to use secure_filename() on uploads to S3/Google Cloud?

In the Flask documentation for file uploads, they recommend use of secure_filename() to sanitize a file's name before storing it. Here's their example: uploaded_file = request.files['file'] if...

CakePhp 3 File Manipulation vulnerability with checkmarx

I keep getting a File Manipulation and File Disclosure report when i run my application through checkmarx. The report states that: The input obtained via add in the file...

Excel VBA macro OLEObjects.add issues

EDIT: I started a new workbook and tore down the original code to test in a fresh environment. None of the OLEObjects.add methods seem to work even in this sanitized environment. I'm beginning to...

How to automatically sanitize ActiveStorage Blob filenames on or before upload?

I am using ActiveStorage on a large Rails app and the client seems to be unable to sanitize their own filenames from non-url-safe characters. I cannot find a way to do this automatically within...

babel-jest : this.setDynamic is not a function (migration to Jest 25)

After upgrading from Jest 23 to Jest 24 or 25 I'm getting following error when attempting to run tests: TypeError:...

AngularJS template loading late. Directive not able to find the elements

I'm working on preparing a .net based AngularJS web application for modern tooling(get rid of nuget in favor of npm, bundling with webpack, etc.) and later on re-writing it to Angular. I'm having...

standard_init_linux.go:219: exec user process caused: no such file or directory

I am trying to move my rust server from Heroku to Google Cloud or AWS. Even though I like the simplicity of having a git push build and deploy to Heroku with just a buildpack specified, the...

TinyMCE 5 file_picker_callback to upload with custom handler

I'm using TinyMCE 5 with PHP 7. Currently: 1. images_upload_handler (working) Following the TinyMCE guide on Drag-in uploading images, and my own PHP upload AJAX handler, I got an image to upload...

Wordpress rename uploaded images based on the post_title

I'm looking for a way to tell wordpress to rename the images attached to the post, by the name of the post. I found this plugin to do the trick but.. it's stupid to use a plugin for such a simple...

Upload an image to a Google spreadsheet from WEB FORM

So basically Its automatically generated script from google sheets. I can't find a link or anything which can help me to tweak it so i could upload an image from my website. It sends only the...

Wordpress Auto Rename and Fill Attributes on upload to CPT

as you can see this code to rename images by post title works fine. even with several posts with the same title. it just puts the numbers: image, image1, image2, image3 .. etc /*Renaming...

React app failed to load config "airbnb" in deploying to heroku

I failed to deploy my create react app to heroku. Error log is below. -----> Build Running build (yarn) yarn run v1.22.10 $ react-scripts build Creating an optimized...